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::DataArrayInt::New;
77 %newobject MEDCoupling::DataArrayInt::__iter__;
78 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
79 %newobject MEDCoupling::DataArrayInt::subArray;
80 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
81 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
82 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
83 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
84 %newobject MEDCoupling::DataArrayInt::renumber;
85 %newobject MEDCoupling::DataArrayInt::renumberR;
86 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
87 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
88 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
89 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
90 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
91 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
92 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
93 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
94 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
95 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
96 %newobject MEDCoupling::DataArrayInt::negate;
97 %newobject MEDCoupling::DataArrayInt::computeAbs;
98 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
99 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
100 %newobject MEDCoupling::DataArrayInt::findIdsStrictlyNegative;
101 %newobject MEDCoupling::DataArrayInt::Aggregate;
102 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
103 %newobject MEDCoupling::DataArrayInt::Meld;
104 %newobject MEDCoupling::DataArrayInt::Add;
105 %newobject MEDCoupling::DataArrayInt::Substract;
106 %newobject MEDCoupling::DataArrayInt::Multiply;
107 %newobject MEDCoupling::DataArrayInt::Divide;
108 %newobject MEDCoupling::DataArrayInt::Pow;
109 %newobject MEDCoupling::DataArrayInt::BuildUnion;
110 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
111 %newobject MEDCoupling::DataArrayInt::Range;
112 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
113 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
114 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
115 %newobject MEDCoupling::DataArrayInt::buildComplement;
116 %newobject MEDCoupling::DataArrayInt::buildUnion;
117 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
118 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
119 %newobject MEDCoupling::DataArrayInt::buildIntersection;
120 %newobject MEDCoupling::DataArrayInt::buildUnique;
121 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
122 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
123 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
124 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
125 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
126 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
127 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
128 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
129 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
130 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
131 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
132 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
133 %newobject MEDCoupling::DataArrayInt::__neg__;
134 %newobject MEDCoupling::DataArrayInt::__add__;
135 %newobject MEDCoupling::DataArrayInt::__radd__;
136 %newobject MEDCoupling::DataArrayInt::__sub__;
137 %newobject MEDCoupling::DataArrayInt::__rsub__;
138 %newobject MEDCoupling::DataArrayInt::__mul__;
139 %newobject MEDCoupling::DataArrayInt::__rmul__;
140 %newobject MEDCoupling::DataArrayInt::__div__;
141 %newobject MEDCoupling::DataArrayInt::__rdiv__;
142 %newobject MEDCoupling::DataArrayInt::__mod__;
143 %newobject MEDCoupling::DataArrayInt::__rmod__;
144 %newobject MEDCoupling::DataArrayInt::__pow__;
145 %newobject MEDCoupling::DataArrayInt::__rpow__;
146 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
147 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
148 %newobject MEDCoupling::DataArrayChar::renumber;
149 %newobject MEDCoupling::DataArrayChar::renumberR;
150 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
151 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
152 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
153 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
154 %newobject MEDCoupling::DataArrayChar::Aggregate;
155 %newobject MEDCoupling::DataArrayChar::Meld;
156 %newobject MEDCoupling::DataArrayByte::New;
157 %newobject MEDCoupling::DataArrayByte::__iter__;
158 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
159 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
160 %newobject MEDCoupling::DataArrayChar::subArray;
161 %newobject MEDCoupling::DataArrayAsciiChar::New;
162 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
163 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
164 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
165 %newobject MEDCoupling::DataArrayDouble::New;
166 %newobject MEDCoupling::DataArrayDouble::__iter__;
167 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
168 %newobject MEDCoupling::DataArrayDouble::Aggregate;
169 %newobject MEDCoupling::DataArrayDouble::Meld;
170 %newobject MEDCoupling::DataArrayDouble::Dot;
171 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
172 %newobject MEDCoupling::DataArrayDouble::Add;
173 %newobject MEDCoupling::DataArrayDouble::Substract;
174 %newobject MEDCoupling::DataArrayDouble::Multiply;
175 %newobject MEDCoupling::DataArrayDouble::Divide;
176 %newobject MEDCoupling::DataArrayDouble::Pow;
177 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
178 %newobject MEDCoupling::DataArrayDouble::subArray;
179 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
180 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
181 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
182 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
183 %newobject MEDCoupling::DataArrayDouble::findIdsStrictlyNegative;
184 %newobject MEDCoupling::DataArrayDouble::negate;
185 %newobject MEDCoupling::DataArrayDouble::computeAbs;
186 %newobject MEDCoupling::DataArrayDouble::applyFunc;
187 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
188 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
189 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
190 %newobject MEDCoupling::DataArrayDouble::determinant;
191 %newobject MEDCoupling::DataArrayDouble::eigenValues;
192 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
193 %newobject MEDCoupling::DataArrayDouble::inverse;
194 %newobject MEDCoupling::DataArrayDouble::trace;
195 %newobject MEDCoupling::DataArrayDouble::deviator;
196 %newobject MEDCoupling::DataArrayDouble::magnitude;
197 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
198 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
199 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
200 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
201 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
202 %newobject MEDCoupling::DataArrayDouble::renumber;
203 %newobject MEDCoupling::DataArrayDouble::renumberR;
204 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
205 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
206 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
207 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
208 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
209 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
210 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
211 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
212 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
213 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
214 %newobject MEDCoupling::DataArrayDouble::cartesianize;
215 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
216 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
217 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
218 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
219 %newobject MEDCoupling::DataArrayDouble::__neg__;
220 %newobject MEDCoupling::DataArrayDouble::__radd__;
221 %newobject MEDCoupling::DataArrayDouble::__rsub__;
222 %newobject MEDCoupling::DataArrayDouble::__rmul__;
223 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
224 %newobject MEDCoupling::DataArrayDouble::__pow__;
225 %newobject MEDCoupling::DataArrayDouble::__rpow__;
226 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
228 %newobject MEDCoupling::PartDefinition::New;
229 %newobject MEDCoupling::PartDefinition::toDAI;
230 %newobject MEDCoupling::PartDefinition::__add__;
231 %newobject MEDCoupling::PartDefinition::composeWith;
232 %newobject MEDCoupling::PartDefinition::tryToSimplify;
233 %newobject MEDCoupling::DataArrayPartDefinition::New;
234 %newobject MEDCoupling::SlicePartDefinition::New;
237 %feature("unref") DataArray "$this->decrRef();"
238 %feature("unref") DataArrayDouble "$this->decrRef();"
239 %feature("unref") DataArrayInt "$this->decrRef();"
240 %feature("unref") DataArrayChar "$this->decrRef();"
241 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
242 %feature("unref") DataArrayByte "$this->decrRef();"
244 %feature("unref") MapII "$this->decrRef();"
245 %feature("unref") PartDefinition "$this->decrRef();"
246 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
247 %feature("unref") SlicePartDefinition "$this->decrRef();"
249 namespace MEDCoupling
256 } MEDCouplingAxisType;
260 class MapII : public RefCountObject, public TimeLabel
263 static MCAuto< MapII > New();
266 class PartDefinition : public RefCountObject, public TimeLabel
269 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
270 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
271 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
272 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
273 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
274 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
275 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
276 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
279 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
281 return (*self)+other;
284 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
287 bool ret0(self->isEqual(other,ret1));
288 PyObject *ret=PyTuple_New(2);
289 PyObject *ret0Py=ret0?Py_True:Py_False;
291 PyTuple_SetItem(ret,0,ret0Py);
292 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
296 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
298 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
302 virtual ~PartDefinition();
305 class DataArrayPartDefinition : public PartDefinition
308 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
311 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
313 return DataArrayPartDefinition::New(listOfIds);
316 std::string __str__() const throw(INTERP_KERNEL::Exception)
318 return self->getRepr();
321 std::string __repr__() const throw(INTERP_KERNEL::Exception)
323 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
324 oss << self->getRepr();
329 virtual ~DataArrayPartDefinition();
332 class SlicePartDefinition : public PartDefinition
335 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
336 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
339 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
341 return SlicePartDefinition::New(start,stop,step);
344 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
347 self->getSlice(a,b,c);
348 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
351 std::string __str__() const throw(INTERP_KERNEL::Exception)
353 return self->getRepr();
356 std::string __repr__() const throw(INTERP_KERNEL::Exception)
358 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
359 oss << self->getRepr();
364 virtual ~SlicePartDefinition();
367 class DataArray : public RefCountObject, public TimeLabel
370 void setName(const std::string& name);
371 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
372 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
373 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
374 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
375 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
376 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
377 std::string getName() const;
378 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
379 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
380 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
381 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
382 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
383 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
384 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
385 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
386 int getNumberOfComponents() const;
387 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
388 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
389 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
390 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
391 virtual void desallocate() throw(INTERP_KERNEL::Exception);
392 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
393 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
394 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
395 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
396 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
397 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
398 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
399 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
400 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
401 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
402 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
403 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
404 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
405 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
406 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
407 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
408 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
409 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
410 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
411 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
412 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
413 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
414 void updateTime() const;
417 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
419 const std::vector<std::string>& comps=self->getInfoOnComponents();
420 PyObject *ret=PyList_New((int)comps.size());
421 for(int i=0;i<(int)comps.size();i++)
422 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
426 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
428 std::vector<int> tmp;
429 convertPyToNewIntArr3(li,tmp);
430 self->copyPartOfStringInfoFrom(other,tmp);
433 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
435 std::vector<int> tmp;
436 convertPyToNewIntArr3(li,tmp);
437 self->copyPartOfStringInfoFrom2(tmp,other);
440 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
443 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
444 if (!SWIG_IsOK(res1))
447 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
448 if(size!=self->getNumberOfTuples())
450 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
452 self->renumberInPlace(tmp);
456 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
458 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
459 da2->checkAllocated();
460 int size=self->getNumberOfTuples();
461 if(size!=self->getNumberOfTuples())
463 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
465 self->renumberInPlace(da2->getConstPointer());
469 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
472 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
473 if (!SWIG_IsOK(res1))
476 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
477 if(size!=self->getNumberOfTuples())
479 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
481 self->renumberInPlaceR(tmp);
485 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
487 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
488 da2->checkAllocated();
489 int size=self->getNumberOfTuples();
490 if(size!=self->getNumberOfTuples())
492 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
494 self->renumberInPlaceR(da2->getConstPointer());
498 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
499 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
501 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
502 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
503 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
504 DataArrayInt *tuplesSelecPtr2=0;
507 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
509 throw INTERP_KERNEL::Exception(msg);
511 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
514 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
516 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
517 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
520 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
522 std::vector<std::pair<int,int> > ranges;
523 convertPyToVectorPairInt(li,ranges);
524 return self->selectByTupleRanges(ranges);
527 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
530 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
531 if (!SWIG_IsOK(res1))
534 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
535 return self->selectByTupleId(tmp,tmp+size);
539 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
541 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
542 da2->checkAllocated();
543 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
547 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
550 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
551 if (!SWIG_IsOK(res1))
554 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
555 return self->selectByTupleIdSafe(tmp,tmp+size);
559 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
561 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
562 da2->checkAllocated();
563 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
567 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
569 std::vector<int> tmp;
570 convertPyToNewIntArr3(li,tmp);
571 DataArray *ret=self->keepSelectedComponents(tmp);
572 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
575 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
577 if(!PySlice_Check(slic))
578 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
579 Py_ssize_t strt=2,stp=2,step=2;
580 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
582 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
583 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
586 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
588 if(!PySlice_Check(slic))
589 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
590 Py_ssize_t strt=2,stp=2,step=2;
591 GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
593 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
594 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
597 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
599 if(!PySlice_Check(slic))
600 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
601 Py_ssize_t strt=2,stp=2,step=2;
602 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
603 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
606 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
608 if(!PySlice_Check(slic))
609 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
610 Py_ssize_t strt=2,stp=2,step=2;
611 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
612 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
615 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
617 std::vector<const DataArray *> tmp;
618 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
619 return DataArray::Aggregate(tmp);
622 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
624 if(!PySlice_Check(slic))
625 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
626 Py_ssize_t strt=2,stp=2,step=2;
627 GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
628 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
631 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
633 if(!PySlice_Check(slic))
634 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
635 Py_ssize_t strt=2,stp=2,step=2;
636 GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
637 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
640 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
642 PyObject *ret(PyTuple_New(2));
643 std::string a0(self->getName());
644 const std::vector<std::string> &a1(self->getInfoOnComponents());
645 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
648 PyObject *ret1(PyList_New(sz));
649 for(int i=0;i<sz;i++)
650 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
651 PyTuple_SetItem(ret,1,ret1);
656 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
658 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 !";
659 if(!PyTuple_Check(inp))
660 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
661 int sz(PyTuple_Size(inp));
663 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
664 PyObject *a0(PyTuple_GetItem(inp,0));
665 self->setName(convertPyObjectToStr(a0,MSG));
666 PyObject *a1(PyTuple_GetItem(inp,1));
667 std::vector<std::string> a1cpp;
668 if(!fillStringVector(a1,a1cpp))
669 throw INTERP_KERNEL::Exception(MSG);
670 self->setInfoOnComponents(a1cpp);
675 class DataArrayDouble;
677 class DataArrayFloat : public DataArray
680 static DataArrayFloat *New();
681 void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
682 bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
683 bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
684 bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
685 void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
686 void iota(float init=0.) throw(INTERP_KERNEL::Exception);
687 DataArrayFloatIterator *iterator() throw(INTERP_KERNEL::Exception);
688 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
689 static DataArrayFloat *Meld(const DataArrayFloat *a1, const DataArrayFloat *a2) throw(INTERP_KERNEL::Exception);
692 DataArrayFloat() throw(INTERP_KERNEL::Exception)
694 return DataArrayFloat::New();
697 static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
699 return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
702 DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
704 return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
707 DataArrayFloatIterator *__iter__() throw(INTERP_KERNEL::Exception)
709 return self->iterator();
712 std::string __repr__() const throw(INTERP_KERNEL::Exception)
714 std::ostringstream oss;
715 self->reprQuickOverview(oss);
719 std::string __str__() const throw(INTERP_KERNEL::Exception)
721 return self->reprNotTooLong();
724 int __len__() const throw(INTERP_KERNEL::Exception)
726 if(self->isAllocated())
728 return self->getNumberOfTuples();
732 throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
736 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
738 const float *vals(self->begin());
739 return convertDblArrToPyList<float>(vals,self->getNbOfElems());
742 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
744 const float *vals(self->begin());
745 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
746 return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
749 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
751 return DataArrayT__getitem<float>(self,obj);
754 DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
756 return DataArrayT__setitem__<float>(self,obj,value);
759 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
761 return DataArrayT_iadd<float>(trueSelf,obj,self);
764 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
766 return DataArrayT_isub<float>(trueSelf,obj,self);
769 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
771 return DataArrayT_imul<float>(trueSelf,obj,self);
774 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
776 return DataArrayT_idiv<float>(trueSelf,obj,self);
780 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
782 return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
787 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
789 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayFloat");
792 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
795 if(!self->isAllocated())
796 throw INTERP_KERNEL::Exception("PyWrap of DataArrayFloat.__getnewargs__ : self is not allocated !");
797 PyObject *ret(PyTuple_New(1));
798 PyObject *ret0(PyDict_New());
799 PyObject *numpyArryObj(MEDCoupling_DataArrayFloat_toNumPyArray(self));
800 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
801 PyObject *tmp1(PyInt_FromLong(0));
802 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
803 PyTuple_SetItem(ret,0,ret0);
807 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
813 class DataArrayFloatTuple;
815 class DataArrayFloatIterator
818 DataArrayFloatIterator(DataArrayFloat *da);
819 ~DataArrayFloatIterator();
824 DataArrayFloatTuple *ret=self->nextt();
826 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple,SWIG_POINTER_OWN|0);
829 PyErr_SetString(PyExc_StopIteration,"No more data.");
836 class DataArrayFloatTuple
839 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
840 DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
843 std::string __str__() const throw(INTERP_KERNEL::Exception)
848 float __float__() const throw(INTERP_KERNEL::Exception)
850 return self->floatValue();
853 DataArrayFloat *buildDAFloat() throw(INTERP_KERNEL::Exception)
855 return self->buildDAFloat(1,self->getNumberOfCompo());
858 /*PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
860 MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
861 MEDCoupling_DataArrayFloat____imul___(ret,0,obj);
862 Py_XINCREF(trueSelf);
866 PyObject *__len__() throw(INTERP_KERNEL::Exception)
868 return PyInt_FromLong(self->getNumberOfCompo());
874 class DataArrayDoubleIterator;
876 class DataArrayDouble : public DataArray
879 static DataArrayDouble *New();
880 double doubleValue() const throw(INTERP_KERNEL::Exception);
881 bool empty() const throw(INTERP_KERNEL::Exception);
882 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
883 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
884 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
885 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
886 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
887 double popBackSilent() throw(INTERP_KERNEL::Exception);
888 void pack() const throw(INTERP_KERNEL::Exception);
889 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
890 void fillWithZero() throw(INTERP_KERNEL::Exception);
891 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
892 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
893 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
894 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
895 void reverse() throw(INTERP_KERNEL::Exception);
896 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
897 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
898 std::string repr() const throw(INTERP_KERNEL::Exception);
899 std::string reprZip() const throw(INTERP_KERNEL::Exception);
900 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
901 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
902 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
903 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
904 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
905 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
906 void transpose() throw(INTERP_KERNEL::Exception);
907 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
908 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
909 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
910 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
911 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
912 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
913 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
914 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
915 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
916 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
917 double front() const throw(INTERP_KERNEL::Exception);
918 double back() const throw(INTERP_KERNEL::Exception);
919 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
920 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
921 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
922 double *getPointer() throw(INTERP_KERNEL::Exception);
923 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
924 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
925 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
926 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
927 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
928 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
929 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
930 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
931 double getAverageValue() const throw(INTERP_KERNEL::Exception);
932 double norm2() const throw(INTERP_KERNEL::Exception);
933 double normMax() const throw(INTERP_KERNEL::Exception);
934 double normMin() const throw(INTERP_KERNEL::Exception);
935 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
936 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
937 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
938 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
939 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
940 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
941 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
942 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
943 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
944 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
945 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
946 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
947 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
948 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
949 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
950 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
951 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
952 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
953 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
954 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
955 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
956 void abs() throw(INTERP_KERNEL::Exception);
957 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
958 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
959 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
960 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
961 void applyPow(double val) throw(INTERP_KERNEL::Exception);
962 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
963 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
964 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
965 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
966 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
967 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
968 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
969 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
970 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
971 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
972 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
973 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
974 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
975 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
976 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
977 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
978 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
979 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
980 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
981 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
982 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
983 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
984 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
985 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
986 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
987 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
988 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
989 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
990 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
991 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
992 MCAuto<DataArrayInt> findIdsGreaterThan(double val) const throw(INTERP_KERNEL::Exception);
993 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
994 MCAuto<DataArrayInt> findIdsLowerThan(double val) const throw(INTERP_KERNEL::Exception);
995 MCAuto<DataArrayInt> convertToIntArr() const throw(INTERP_KERNEL::Exception);
996 MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
997 MCAuto<DataArrayDouble> cumSum() const throw(INTERP_KERNEL::Exception);
998 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
1001 DataArrayDouble() throw(INTERP_KERNEL::Exception)
1003 return DataArrayDouble::New();
1006 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1008 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
1011 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1013 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
1016 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
1019 std::vector<double> bb;
1021 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
1022 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
1023 self->pushBackValsSilent(tmp,tmp+nbTuples);
1026 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1028 std::ostringstream oss;
1029 self->reprQuickOverview(oss);
1033 std::string __str__() const throw(INTERP_KERNEL::Exception)
1035 return self->reprNotTooLong();
1038 double __float__() const throw(INTERP_KERNEL::Exception)
1040 return self->doubleValue();
1043 int __len__() const throw(INTERP_KERNEL::Exception)
1045 if(self->isAllocated())
1047 return self->getNumberOfTuples();
1051 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
1055 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
1057 return self->iterator();
1060 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1062 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 !";
1063 if(PyList_Check(li) || PyTuple_Check(li))
1067 if(PyInt_Check(nbOfTuples))
1069 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1071 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
1074 if(PyInt_Check(nbOfComp))
1075 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
1076 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1078 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
1079 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
1080 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1083 throw INTERP_KERNEL::Exception(msg);
1086 {//DataArrayDouble.setValues([1.,3.,4.],3)
1088 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
1089 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1093 throw INTERP_KERNEL::Exception(msg);
1096 {// DataArrayDouble.setValues([1.,3.,4.])
1097 int tmpp1=-1,tmpp2=-1;
1098 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
1099 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1103 throw INTERP_KERNEL::Exception(msg);
1106 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
1108 const double *vals(self->begin());
1109 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
1113 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
1115 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1119 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1122 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1123 PyObject *ret=PyTuple_New(2);
1124 PyObject *ret0Py=ret0?Py_True:Py_False;
1126 PyTuple_SetItem(ret,0,ret0Py);
1127 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1131 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1133 const double *vals(self->begin());
1134 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1135 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1138 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1140 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1142 DataArrayDouble *a,*a2;
1143 DataArrayDoubleTuple *aa,*aa2;
1144 std::vector<double> bb,bb2;
1146 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1147 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1148 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1152 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1154 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1156 DataArrayDouble *a,*a2;
1157 DataArrayDoubleTuple *aa,*aa2;
1158 std::vector<double> bb,bb2;
1160 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1162 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1163 return convertDblArrToPyListOfTuple<double>(res,3,3);
1166 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1168 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1170 DataArrayDouble *a,*a2;
1171 DataArrayDoubleTuple *aa,*aa2;
1172 std::vector<double> bb,bb2;
1174 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1175 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1176 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1179 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1182 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1183 if (!SWIG_IsOK(res1))
1186 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1187 if(size!=self->getNumberOfTuples())
1189 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1191 return self->renumber(tmp);
1195 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1197 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1198 da2->checkAllocated();
1199 int size=self->getNumberOfTuples();
1200 if(size!=self->getNumberOfTuples())
1202 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1204 return self->renumber(da2->getConstPointer());
1208 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1211 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1212 if (!SWIG_IsOK(res1))
1215 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1216 if(size!=self->getNumberOfTuples())
1218 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1220 return self->renumberR(tmp);
1224 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1226 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1227 da2->checkAllocated();
1228 int size=self->getNumberOfTuples();
1229 if(size!=self->getNumberOfTuples())
1231 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1233 return self->renumberR(da2->getConstPointer());
1237 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1240 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1241 if (!SWIG_IsOK(res1))
1244 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1245 if(size!=self->getNumberOfTuples())
1247 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1249 return self->renumberAndReduce(tmp,newNbOfTuple);
1253 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1255 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1256 da2->checkAllocated();
1257 int size=self->getNumberOfTuples();
1258 if(size!=self->getNumberOfTuples())
1260 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1262 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1266 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1268 int thisTupleId,otherTupleId;
1269 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1270 PyObject *ret=PyTuple_New(3);
1271 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1272 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1273 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1277 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1280 double r1=self->getMaxValue(tmp);
1281 PyObject *ret=PyTuple_New(2);
1282 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1283 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1287 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1290 double r1=self->getMaxValue2(tmp);
1291 PyObject *ret=PyTuple_New(2);
1292 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1293 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1297 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1300 double r1=self->getMinValue(tmp);
1301 PyObject *ret=PyTuple_New(2);
1302 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1303 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1307 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1310 double r1=self->getMinValue2(tmp);
1311 PyObject *ret=PyTuple_New(2);
1312 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1313 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1317 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1319 int nbOfCompo(self->getNumberOfComponents());
1320 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1321 self->getMinMaxPerComponent(tmp);
1322 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1326 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1328 int sz=self->getNumberOfComponents();
1329 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1330 self->accumulate(tmp);
1331 return convertDblArrToPyList<double>(tmp,sz);
1334 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1337 std::vector<int> val2;
1338 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1339 return self->accumulatePerChunck(bg,bg+sz);
1342 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1344 DataArrayInt *comm, *commIndex;
1345 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1346 PyObject *res = PyList_New(2);
1347 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1348 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1352 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1356 DataArrayDoubleTuple *aa;
1357 std::vector<double> bb;
1359 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1360 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1362 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1363 PyObject *ret=PyTuple_New(2);
1364 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1365 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1369 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1371 std::vector<int> tmp;
1372 convertPyToNewIntArr3(li,tmp);
1373 self->setSelectedComponents(a,tmp);
1376 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1378 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1379 std::size_t sz(retCpp.size());
1380 PyObject *res(PyList_New(sz));
1381 for(std::size_t i=0;i<sz;i++)
1382 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1386 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1388 int sz=self->getNumberOfComponents();
1389 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1390 self->getTuple(tupleId,tmp);
1391 return convertDblArrToPyList<double>(tmp,sz);
1394 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1396 std::vector<const DataArrayDouble *> tmp;
1397 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1398 return DataArrayDouble::Aggregate(tmp);
1401 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1403 std::vector<const DataArrayDouble *> tmp;
1404 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1405 return DataArrayDouble::Meld(tmp);
1408 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1412 DataArrayDoubleTuple *aa;
1413 std::vector<double> bb;
1415 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1416 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1417 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1418 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1419 DataArrayInt *c=0,*cI=0;
1420 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1421 PyObject *ret=PyTuple_New(2);
1422 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1423 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1427 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1429 DataArrayInt *ret1=0;
1430 bool ret0=self->areIncludedInMe(other,prec,ret1);
1431 PyObject *ret=PyTuple_New(2);
1432 PyObject *ret0Py=ret0?Py_True:Py_False;
1434 PyTuple_SetItem(ret,0,ret0Py);
1435 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1439 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1441 return DataArrayT__getitem<double>(self,obj);
1444 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1446 return DataArrayT__setitem__<double>(self,obj,value);
1449 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1451 return self->negate();
1454 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1456 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1459 DataArrayDoubleTuple *aa;
1460 std::vector<double> bb;
1463 #ifndef WITHOUT_AUTOFIELD
1465 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1467 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1470 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1471 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1473 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1476 throw INTERP_KERNEL::Exception(msg);
1480 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1485 MCAuto<DataArrayDouble> ret=self->deepCopy();
1486 ret->applyLin(1.,val);
1487 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1491 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1495 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1496 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1500 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1501 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1504 throw INTERP_KERNEL::Exception(msg);
1508 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1510 const char msg[]="Unexpected situation in __radd__ !";
1513 DataArrayDoubleTuple *aa;
1514 std::vector<double> bb;
1516 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1521 MCAuto<DataArrayDouble> ret=self->deepCopy();
1522 ret->applyLin(1.,val);
1527 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1528 return DataArrayDouble::Add(self,aaa);
1532 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1533 return DataArrayDouble::Add(self,aaa);
1536 throw INTERP_KERNEL::Exception(msg);
1540 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1542 return DataArrayT_iadd<double>(trueSelf,obj,self);
1545 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1547 const char msg[]="Unexpected situation in __sub__ !";
1550 DataArrayDoubleTuple *aa;
1551 std::vector<double> bb;
1554 #ifndef WITHOUT_AUTOFIELD
1556 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1558 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1561 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1562 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1564 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1567 throw INTERP_KERNEL::Exception(msg);
1571 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1576 MCAuto<DataArrayDouble> ret=self->deepCopy();
1577 ret->applyLin(1.,-val);
1578 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1582 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1586 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1587 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1591 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1592 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1595 throw INTERP_KERNEL::Exception(msg);
1599 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1601 const char msg[]="Unexpected situation in __rsub__ !";
1604 DataArrayDoubleTuple *aa;
1605 std::vector<double> bb;
1607 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1612 MCAuto<DataArrayDouble> ret=self->deepCopy();
1613 ret->applyLin(-1.,val);
1618 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1619 return DataArrayDouble::Substract(aaa,self);
1623 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1624 return DataArrayDouble::Substract(aaa,self);
1627 throw INTERP_KERNEL::Exception(msg);
1631 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1633 return DataArrayT_isub<double>(trueSelf,obj,self);
1636 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1638 const char msg[]="Unexpected situation in __mul__ !";
1641 DataArrayDoubleTuple *aa;
1642 std::vector<double> bb;
1645 #ifndef WITHOUT_AUTOFIELD
1647 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1649 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1652 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1653 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1655 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1658 throw INTERP_KERNEL::Exception(msg);
1662 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1667 MCAuto<DataArrayDouble> ret=self->deepCopy();
1668 ret->applyLin(val,0.);
1669 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1673 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1677 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1678 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1682 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1683 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1686 throw INTERP_KERNEL::Exception(msg);
1690 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1692 const char msg[]="Unexpected situation in __rmul__ !";
1695 DataArrayDoubleTuple *aa;
1696 std::vector<double> bb;
1698 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1703 MCAuto<DataArrayDouble> ret=self->deepCopy();
1704 ret->applyLin(val,0.);
1709 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1710 return DataArrayDouble::Multiply(self,aaa);
1714 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1715 return DataArrayDouble::Multiply(self,aaa);
1718 throw INTERP_KERNEL::Exception(msg);
1722 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1724 return DataArrayT_imul<double>(trueSelf,obj,self);
1727 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1729 const char msg[]="Unexpected situation in __div__ !";
1732 DataArrayDoubleTuple *aa;
1733 std::vector<double> bb;
1736 #ifndef WITHOUT_AUTOFIELD
1738 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1740 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1743 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1744 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1746 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1749 throw INTERP_KERNEL::Exception(msg);
1753 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1759 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1760 MCAuto<DataArrayDouble> ret=self->deepCopy();
1761 ret->applyLin(1/val,0.);
1762 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1766 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1770 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1771 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1775 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1776 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1779 throw INTERP_KERNEL::Exception(msg);
1783 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1785 const char msg[]="Unexpected situation in __rdiv__ !";
1788 DataArrayDoubleTuple *aa;
1789 std::vector<double> bb;
1791 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1796 MCAuto<DataArrayDouble> ret=self->deepCopy();
1802 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1803 return DataArrayDouble::Divide(aaa,self);
1807 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1808 return DataArrayDouble::Divide(aaa,self);
1811 throw INTERP_KERNEL::Exception(msg);
1815 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1817 return DataArrayT_idiv<double>(trueSelf,obj,self);
1820 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1822 const char msg[]="Unexpected situation in __pow__ !";
1825 DataArrayDoubleTuple *aa;
1826 std::vector<double> bb;
1828 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1833 MCAuto<DataArrayDouble> ret=self->deepCopy();
1839 return DataArrayDouble::Pow(self,a);
1843 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1844 return DataArrayDouble::Pow(self,aaa);
1848 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1849 return DataArrayDouble::Pow(self,aaa);
1852 throw INTERP_KERNEL::Exception(msg);
1856 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1858 const char msg[]="Unexpected situation in __rpow__ !";
1861 DataArrayDoubleTuple *aa;
1862 std::vector<double> bb;
1864 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1869 MCAuto<DataArrayDouble> ret=self->deepCopy();
1870 ret->applyRPow(val);
1875 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1876 return DataArrayDouble::Pow(aaa,self);
1880 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1881 return DataArrayDouble::Pow(aaa,self);
1884 throw INTERP_KERNEL::Exception(msg);
1888 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1890 const char msg[]="Unexpected situation in __ipow__ !";
1893 DataArrayDoubleTuple *aa;
1894 std::vector<double> bb;
1896 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1901 self->applyPow(val);
1902 Py_XINCREF(trueSelf);
1908 Py_XINCREF(trueSelf);
1913 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1914 self->powEqual(aaa);
1915 Py_XINCREF(trueSelf);
1920 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1921 self->powEqual(aaa);
1922 Py_XINCREF(trueSelf);
1926 throw INTERP_KERNEL::Exception(msg);
1930 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1932 DataArrayInt *c=0,*cI=0;
1934 self->computeTupleIdsNearTuples(other,eps,c,cI);
1935 PyObject *ret=PyTuple_New(2);
1936 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1937 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1941 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1943 DataArrayInt *ret1=0;
1944 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1945 PyObject *ret=PyTuple_New(2);
1946 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1947 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1952 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
1954 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
1957 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
1960 if(!self->isAllocated())
1961 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
1962 PyObject *ret(PyTuple_New(1));
1963 PyObject *ret0(PyDict_New());
1964 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
1965 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
1966 PyObject *tmp1(PyInt_FromLong(0));
1967 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
1968 PyTuple_SetItem(ret,0,ret0);
1972 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
1978 class DataArrayDoubleTuple;
1980 class DataArrayDoubleIterator
1983 DataArrayDoubleIterator(DataArrayDouble *da);
1984 ~DataArrayDoubleIterator();
1989 DataArrayDoubleTuple *ret=self->nextt();
1991 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1994 PyErr_SetString(PyExc_StopIteration,"No more data.");
2001 class DataArrayDoubleTuple
2004 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2005 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2008 std::string __str__() const throw(INTERP_KERNEL::Exception)
2010 return self->repr();
2013 double __float__() const throw(INTERP_KERNEL::Exception)
2015 return self->doubleValue();
2018 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2020 return self->buildDADouble(1,self->getNumberOfCompo());
2023 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2025 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2026 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2027 Py_XINCREF(trueSelf);
2031 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2033 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2034 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2035 Py_XINCREF(trueSelf);
2039 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2041 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2042 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2043 Py_XINCREF(trueSelf);
2047 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2049 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2050 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2051 Py_XINCREF(trueSelf);
2055 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2057 return PyInt_FromLong(self->getNumberOfCompo());
2060 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2062 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2065 std::vector<int> multiVal;
2066 std::pair<int, std::pair<int,int> > slic;
2067 MEDCoupling::DataArrayInt *daIntTyypp=0;
2068 const double *pt=self->getConstPointer();
2069 int nbc=self->getNumberOfCompo();
2070 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2077 std::ostringstream oss;
2078 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2079 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2083 return PyFloat_FromDouble(pt[singleVal]);
2087 return PyFloat_FromDouble(pt[nbc+singleVal]);
2090 std::ostringstream oss;
2091 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2092 throw INTERP_KERNEL::Exception(oss.str().c_str());
2098 PyObject *t=PyTuple_New(multiVal.size());
2099 for(int j=0;j<(int)multiVal.size();j++)
2101 int cid=multiVal[j];
2104 std::ostringstream oss;
2105 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2106 throw INTERP_KERNEL::Exception(oss.str().c_str());
2108 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2114 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2115 PyObject *t=PyTuple_New(sz);
2116 for(int j=0;j<sz;j++)
2117 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2121 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2125 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2127 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2128 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2131 std::vector<double> multiValV;
2132 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2133 int nbc=self->getNumberOfCompo();
2134 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2136 std::vector<int> multiVal;
2137 std::pair<int, std::pair<int,int> > slic;
2138 MEDCoupling::DataArrayInt *daIntTyypp=0;
2139 double *pt=self->getPointer();
2140 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2147 std::ostringstream oss;
2148 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2149 throw INTERP_KERNEL::Exception(oss.str().c_str());
2155 pt[singleVal]=singleValV;
2160 if(multiValV.size()!=1)
2162 std::ostringstream oss;
2163 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2164 throw INTERP_KERNEL::Exception(oss.str().c_str());
2166 pt[singleVal]=multiValV[0];
2171 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2175 throw INTERP_KERNEL::Exception(msg);
2184 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2188 std::ostringstream oss;
2189 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2190 throw INTERP_KERNEL::Exception(oss.str().c_str());
2198 if(multiVal.size()!=multiValV.size())
2200 std::ostringstream oss;
2201 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2202 throw INTERP_KERNEL::Exception(oss.str().c_str());
2204 for(int i=0;i<(int)multiVal.size();i++)
2206 int pos=multiVal[i];
2209 std::ostringstream oss;
2210 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2211 throw INTERP_KERNEL::Exception(oss.str().c_str());
2213 pt[multiVal[i]]=multiValV[i];
2219 const double *ptV=daIntTyyppV->getConstPointer();
2220 if(nbc>daIntTyyppV->getNumberOfCompo())
2222 std::ostringstream oss;
2223 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2224 throw INTERP_KERNEL::Exception(oss.str().c_str());
2226 std::copy(ptV,ptV+nbc,pt);
2230 throw INTERP_KERNEL::Exception(msg);
2235 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2240 for(int j=0;j<sz;j++)
2241 pt[slic.first+j*slic.second.second]=singleValV;
2246 if(sz!=(int)multiValV.size())
2248 std::ostringstream oss;
2249 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2250 throw INTERP_KERNEL::Exception(oss.str().c_str());
2252 for(int j=0;j<sz;j++)
2253 pt[slic.first+j*slic.second.second]=multiValV[j];
2258 const double *ptV=daIntTyyppV->getConstPointer();
2259 if(sz>daIntTyyppV->getNumberOfCompo())
2261 std::ostringstream oss;
2262 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2263 throw INTERP_KERNEL::Exception(oss.str().c_str());
2265 for(int j=0;j<sz;j++)
2266 pt[slic.first+j*slic.second.second]=ptV[j];
2270 throw INTERP_KERNEL::Exception(msg);
2274 throw INTERP_KERNEL::Exception(msg);
2280 class DataArrayIntIterator;
2282 class DataArrayInt : public DataArray
2285 static DataArrayInt *New();
2286 int intValue() const throw(INTERP_KERNEL::Exception);
2287 int getHashCode() const throw(INTERP_KERNEL::Exception);
2288 bool empty() const throw(INTERP_KERNEL::Exception);
2289 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2290 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2291 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2292 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2293 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2294 int popBackSilent() throw(INTERP_KERNEL::Exception);
2295 void pack() const throw(INTERP_KERNEL::Exception);
2296 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2297 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2298 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2299 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2300 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2301 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2302 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2303 void reverse() throw(INTERP_KERNEL::Exception);
2304 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2305 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2306 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2307 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2308 void fillWithZero() throw(INTERP_KERNEL::Exception);
2309 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2310 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2311 std::string repr() const throw(INTERP_KERNEL::Exception);
2312 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2313 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2314 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2315 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2316 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2317 MCAuto< MapII > invertArrayN2O2O2NOptimized() const throw(INTERP_KERNEL::Exception);
2318 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2319 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2320 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2321 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2322 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2323 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2324 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2325 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2326 int checkUniformAndGuess() const throw(INTERP_KERNEL::Exception);
2327 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2328 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2329 void transpose() throw(INTERP_KERNEL::Exception);
2330 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2331 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2332 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2333 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2334 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2335 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2336 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2337 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2338 int front() const throw(INTERP_KERNEL::Exception);
2339 int back() const throw(INTERP_KERNEL::Exception);
2340 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2341 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2342 int *getPointer() throw(INTERP_KERNEL::Exception);
2343 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2344 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2345 const int *begin() const throw(INTERP_KERNEL::Exception);
2346 const int *end() const throw(INTERP_KERNEL::Exception);
2347 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2348 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2349 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2350 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2351 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2352 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2353 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2354 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2355 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2356 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2357 int count(int value) const throw(INTERP_KERNEL::Exception);
2358 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2359 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2360 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2361 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2362 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2363 void abs() throw(INTERP_KERNEL::Exception);
2364 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2365 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2366 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2367 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2368 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2369 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2370 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2371 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2372 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2373 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2374 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2375 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2376 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2377 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2378 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2379 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2380 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2381 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2382 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2383 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2384 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2385 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2386 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2387 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2388 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2389 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2390 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2391 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2392 void computeOffsets() throw(INTERP_KERNEL::Exception);
2393 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2394 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2395 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2396 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2397 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2398 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2399 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2400 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2401 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2402 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2403 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2404 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2405 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2406 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2407 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2408 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2409 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2410 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2411 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2412 MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
2413 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2414 MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
2415 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2416 MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
2417 MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
2418 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
2419 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
2421 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2424 DataArrayInt() throw(INTERP_KERNEL::Exception)
2426 return DataArrayInt::New();
2429 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2431 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)";
2432 std::string msg(msgBase);
2434 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2437 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2441 if(PyInt_Check(nbOfTuples))
2443 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2445 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2448 if(PyInt_Check(nbOfComp))
2449 {//DataArrayInt.New([1,3,4,5],2,2)
2450 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2452 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2453 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2454 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2455 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2459 throw INTERP_KERNEL::Exception(msg.c_str());
2462 {//DataArrayInt.New([1,3,4],3)
2463 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2465 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2466 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2471 throw INTERP_KERNEL::Exception(msg.c_str());
2474 {// DataArrayInt.New([1,3,4])
2475 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2476 int tmpp1=-1,tmpp2=-1;
2477 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2478 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2482 else if(PyInt_Check(elt0))
2484 int nbOfTuples1=PyInt_AS_LONG(elt0);
2486 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2491 if(PyInt_Check(nbOfTuples))
2492 {//DataArrayInt.New(5,2)
2493 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2495 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2496 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2497 ret->alloc(nbOfTuples1,nbOfCompo);
2501 throw INTERP_KERNEL::Exception(msg.c_str());
2504 throw INTERP_KERNEL::Exception(msg.c_str());
2507 {//DataArrayInt.New(5)
2508 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2509 ret->alloc(nbOfTuples1,1);
2514 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2515 {//DataArrayInt.New(numpyArray)
2516 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2520 throw INTERP_KERNEL::Exception(msg.c_str());
2521 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2524 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2526 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2529 std::string __str__() const throw(INTERP_KERNEL::Exception)
2531 return self->reprNotTooLong();
2534 int __len__() const throw(INTERP_KERNEL::Exception)
2536 if(self->isAllocated())
2538 return self->getNumberOfTuples();
2542 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2546 int __int__() const throw(INTERP_KERNEL::Exception)
2548 return self->intValue();
2551 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2553 return self->iterator();
2556 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2558 int sz=self->getNumberOfComponents();
2559 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2560 self->accumulate(tmp);
2561 return convertIntArrToPyList(tmp,sz);
2564 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2567 std::vector<int> val2;
2568 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2569 return self->accumulatePerChunck(bg,bg+sz);
2572 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2575 std::vector<int> val2;
2576 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2577 return self->findIdsEqualTuple(bg,bg+sz);
2580 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2582 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2583 PyObject *ret=PyList_New(slcs.size());
2584 for(std::size_t i=0;i<slcs.size();i++)
2585 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2589 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2591 if(!PySlice_Check(slic))
2592 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2593 Py_ssize_t strt=2,stp=2,step=2;
2594 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2595 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2596 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 !");
2597 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2600 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2603 self->getMinMaxValues(a,b);
2604 PyObject *ret=PyTuple_New(2);
2605 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2606 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2610 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2612 int newNbOfTuples=-1;
2613 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2614 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2615 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2616 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2617 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2618 PyObject *ret=PyTuple_New(2);
2619 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2620 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2624 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2626 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2627 int szArr,sw,iTypppArr;
2628 std::vector<int> stdvecTyyppArr;
2629 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2630 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2631 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2635 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2637 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 !";
2638 if(PyList_Check(li) || PyTuple_Check(li))
2640 if(nbOfTuples && nbOfTuples != Py_None)
2642 if(PyInt_Check(nbOfTuples))
2644 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2646 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2647 if(nbOfComp && nbOfComp != Py_None)
2649 if(PyInt_Check(nbOfComp))
2650 {//DataArrayInt.setValues([1,3,4,5],2,2)
2651 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2653 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2654 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2655 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2658 throw INTERP_KERNEL::Exception(msg);
2661 {//DataArrayInt.setValues([1,3,4],3)
2663 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2664 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2668 throw INTERP_KERNEL::Exception(msg);
2671 {// DataArrayInt.setValues([1,3,4])
2672 int tmpp1=-1,tmpp2=-1;
2673 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2674 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2678 throw INTERP_KERNEL::Exception(msg);
2681 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2683 const int *vals=self->getConstPointer();
2684 return convertIntArrToPyList(vals,self->getNbOfElems());
2688 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2690 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2694 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2697 bool ret0=self->isEqualIfNotWhy(other,ret1);
2698 PyObject *ret=PyTuple_New(2);
2699 PyObject *ret0Py=ret0?Py_True:Py_False;
2701 PyTuple_SetItem(ret,0,ret0Py);
2702 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2706 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2708 const int *vals=self->getConstPointer();
2709 int nbOfComp=self->getNumberOfComponents();
2710 int nbOfTuples=self->getNumberOfTuples();
2711 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2714 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2716 std::vector<const DataArrayInt *> groups;
2717 std::vector< std::vector<int> > fidsOfGroups;
2718 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2719 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2720 PyObject *ret = PyList_New(2);
2721 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2722 int sz=fidsOfGroups.size();
2723 PyObject *ret1 = PyList_New(sz);
2724 for(int i=0;i<sz;i++)
2725 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2726 PyList_SetItem(ret,1,ret1);
2730 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2733 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
2734 if (!SWIG_IsOK(res1))
2736 int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
2739 MapII *m=reinterpret_cast<MapII *>(da);
2740 self->transformWithIndArr(*m);
2745 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2746 self->transformWithIndArr(tmp,tmp+size);
2751 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2752 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2756 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2760 std::vector<int> multiVal;
2761 std::pair<int, std::pair<int,int> > slic;
2762 MEDCoupling::DataArrayInt *daIntTyypp=0;
2763 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2767 return self->findIdsEqualList(&singleVal,&singleVal+1);
2769 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2771 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2773 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2777 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2781 std::vector<int> multiVal;
2782 std::pair<int, std::pair<int,int> > slic;
2783 MEDCoupling::DataArrayInt *daIntTyypp=0;
2784 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2788 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2790 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2792 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2794 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2798 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2800 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2802 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2803 if (!SWIG_IsOK(res1))
2806 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2807 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2811 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2813 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2814 da2->checkAllocated();
2815 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2817 PyObject *ret = PyList_New(3);
2818 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2819 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2820 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2824 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2827 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2828 if (!SWIG_IsOK(res1))
2831 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2832 return self->transformWithIndArrR(tmp,tmp+size);
2836 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2837 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2841 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2844 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2845 if (!SWIG_IsOK(res1))
2848 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2849 if(size!=self->getNumberOfTuples())
2851 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2853 return self->renumberAndReduce(tmp,newNbOfTuple);
2857 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2859 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2860 da2->checkAllocated();
2861 int size=self->getNumberOfTuples();
2862 if(size!=self->getNumberOfTuples())
2864 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2866 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2870 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2873 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2874 if (!SWIG_IsOK(res1))
2877 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2878 if(size!=self->getNumberOfTuples())
2880 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2882 return self->renumber(tmp);
2886 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2888 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2889 da2->checkAllocated();
2890 int size=self->getNumberOfTuples();
2891 if(size!=self->getNumberOfTuples())
2893 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2895 return self->renumber(da2->getConstPointer());
2899 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2902 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2903 if (!SWIG_IsOK(res1))
2906 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2907 if(size!=self->getNumberOfTuples())
2909 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2911 return self->renumberR(tmp);
2915 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2917 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2918 da2->checkAllocated();
2919 int size=self->getNumberOfTuples();
2920 if(size!=self->getNumberOfTuples())
2922 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2924 return self->renumberR(da2->getConstPointer());
2928 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2930 std::vector<int> tmp;
2931 convertPyToNewIntArr3(li,tmp);
2932 self->setSelectedComponents(a,tmp);
2935 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2937 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2938 std::size_t sz(retCpp.size());
2939 PyObject *res(PyList_New(sz));
2940 for(std::size_t i=0;i<sz;i++)
2941 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2945 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2947 int sz=self->getNumberOfComponents();
2948 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2949 self->getTuple(tupleId,tmp);
2950 return convertIntArrToPyList(tmp,sz);
2953 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2955 DataArrayInt *arr=0;
2956 DataArrayInt *arrI=0;
2957 self->changeSurjectiveFormat(targetNb,arr,arrI);
2958 PyObject *res = PyList_New(2);
2959 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2960 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2964 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2966 std::vector<const DataArrayInt *> tmp;
2967 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2968 return DataArrayInt::Meld(tmp);
2971 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2973 std::vector<const DataArrayInt *> tmp;
2974 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2975 return DataArrayInt::Aggregate(tmp);
2978 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2980 std::vector<const DataArrayInt *> tmp;
2981 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2982 return DataArrayInt::AggregateIndexes(tmp);
2985 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2987 std::vector<const DataArrayInt *> tmp;
2988 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2989 return DataArrayInt::BuildUnion(tmp);
2992 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2994 std::vector<const DataArrayInt *> tmp;
2995 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2996 return DataArrayInt::BuildIntersection(tmp);
2999 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3002 int r1=self->getMaxValue(tmp);
3003 PyObject *ret=PyTuple_New(2);
3004 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3005 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3009 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3012 int r1=self->getMinValue(tmp);
3013 PyObject *ret=PyTuple_New(2);
3014 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3015 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3019 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3021 int nbOfCompo=self->getNumberOfComponents();
3026 if(PyInt_Check(obj))
3028 int val=(int)PyInt_AS_LONG(obj);
3029 return self->findIdFirstEqual(val);
3032 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3036 std::vector<int> arr;
3037 convertPyToNewIntArr3(obj,arr);
3038 return self->findIdFirstEqualTuple(arr);
3043 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3045 int nbOfCompo=self->getNumberOfComponents();
3052 if(PyInt_Check(obj))
3054 int val=(int)PyInt_AS_LONG(obj);
3055 return self->presenceOfValue(val);
3058 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3062 std::vector<int> arr;
3063 convertPyToNewIntArr3(obj,arr);
3064 return self->presenceOfTuple(arr);
3069 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3071 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3072 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3073 self->checkAllocated();
3074 int nbOfTuples=self->getNumberOfTuples();
3075 int nbOfComponents=self->getNumberOfComponents();
3077 std::vector<int> vt1,vc1;
3078 std::pair<int, std::pair<int,int> > pt1,pc1;
3079 DataArrayInt *dt1=0,*dc1=0;
3081 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3082 MCAuto<DataArrayInt> ret;
3087 if(nbOfComponents==1)
3088 return PyInt_FromLong(self->getIJSafe(it1,0));
3089 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3092 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3094 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3096 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3098 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3101 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3102 std::vector<int> v2(1,ic1);
3103 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3107 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3108 std::vector<int> v2(1,ic1);
3109 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3113 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3114 std::vector<int> v2(1,ic1);
3115 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3119 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3120 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3124 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3125 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3129 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3130 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3134 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3135 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3139 ret=self->selectByTupleIdSafe(&it1,&it1+1);
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->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
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->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
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 );
3166 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3167 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3168 std::vector<int> v2(nbOfComp);
3169 for(int i=0;i<nbOfComp;i++)
3170 v2[i]=pc1.first+i*pc1.second.second;
3171 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3174 throw INTERP_KERNEL::Exception(msg);
3178 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3180 self->checkAllocated();
3181 const char msg[]="Unexpected situation in __setitem__ !";
3182 int nbOfTuples=self->getNumberOfTuples();
3183 int nbOfComponents=self->getNumberOfComponents();
3186 std::vector<int> v1;
3188 DataArrayIntTuple *dd1=0;
3189 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3191 std::vector<int> vt1,vc1;
3192 std::pair<int, std::pair<int,int> > pt1,pc1;
3193 DataArrayInt *dt1=0,*dc1=0;
3194 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3195 MCAuto<DataArrayInt> tmp;
3203 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3206 tmp=DataArrayInt::New();
3207 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3208 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3211 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3214 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3215 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3218 throw INTERP_KERNEL::Exception(msg);
3227 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3230 tmp=DataArrayInt::New();
3231 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3232 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3235 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3238 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3239 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3242 throw INTERP_KERNEL::Exception(msg);
3251 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3254 tmp=DataArrayInt::New();
3255 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3256 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3259 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3262 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3263 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3266 throw INTERP_KERNEL::Exception(msg);
3275 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3278 tmp=DataArrayInt::New();
3279 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3280 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3283 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3286 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3287 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3290 throw INTERP_KERNEL::Exception(msg);
3299 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3302 tmp=DataArrayInt::New();
3303 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3304 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3307 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3310 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3311 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3314 throw INTERP_KERNEL::Exception(msg);
3323 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3326 tmp=DataArrayInt::New();
3327 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3328 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3331 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3334 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3335 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3338 throw INTERP_KERNEL::Exception(msg);
3347 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3350 tmp=DataArrayInt::New();
3351 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3352 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3355 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3358 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3359 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3362 throw INTERP_KERNEL::Exception(msg);
3371 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3374 tmp=DataArrayInt::New();
3375 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3376 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3379 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3382 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3383 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3386 throw INTERP_KERNEL::Exception(msg);
3395 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3398 tmp=DataArrayInt::New();
3399 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3400 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3403 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3406 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3407 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3410 throw INTERP_KERNEL::Exception(msg);
3419 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3422 tmp=DataArrayInt::New();
3423 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3424 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3427 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3430 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3431 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3434 throw INTERP_KERNEL::Exception(msg);
3443 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3446 tmp=DataArrayInt::New();
3447 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3448 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3451 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3454 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3455 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3458 throw INTERP_KERNEL::Exception(msg);
3467 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3470 tmp=DataArrayInt::New();
3471 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3472 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3475 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3478 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3479 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3482 throw INTERP_KERNEL::Exception(msg);
3491 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3494 tmp=DataArrayInt::New();
3495 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3496 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3499 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3502 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3503 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3506 throw INTERP_KERNEL::Exception(msg);
3515 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3518 tmp=DataArrayInt::New();
3519 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3520 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3523 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3526 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3527 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3530 throw INTERP_KERNEL::Exception(msg);
3539 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3542 tmp=DataArrayInt::New();
3543 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3544 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3547 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3550 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3551 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3554 throw INTERP_KERNEL::Exception(msg);
3563 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3566 tmp=DataArrayInt::New();
3567 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3568 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3571 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3574 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3575 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3578 throw INTERP_KERNEL::Exception(msg);
3583 throw INTERP_KERNEL::Exception(msg);
3588 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3590 return self->negate();
3593 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3595 const char msg[]="Unexpected situation in __add__ !";
3598 std::vector<int> aa;
3599 DataArrayIntTuple *aaa;
3601 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3606 MCAuto<DataArrayInt> ret=self->deepCopy();
3607 ret->applyLin(1,val);
3612 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3613 return DataArrayInt::Add(self,aaaa);
3617 return DataArrayInt::Add(self,a);
3621 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3622 return DataArrayInt::Add(self,aaaa);
3625 throw INTERP_KERNEL::Exception(msg);
3629 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3631 const char msg[]="Unexpected situation in __radd__ !";
3634 std::vector<int> aa;
3635 DataArrayIntTuple *aaa;
3637 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3642 MCAuto<DataArrayInt> ret=self->deepCopy();
3643 ret->applyLin(1,val);
3648 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3649 return DataArrayInt::Add(self,aaaa);
3653 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3654 return DataArrayInt::Add(self,aaaa);
3657 throw INTERP_KERNEL::Exception(msg);
3661 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3663 const char msg[]="Unexpected situation in __iadd__ !";
3666 std::vector<int> aa;
3667 DataArrayIntTuple *aaa;
3669 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3674 self->applyLin(1,val);
3675 Py_XINCREF(trueSelf);
3680 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3682 Py_XINCREF(trueSelf);
3688 Py_XINCREF(trueSelf);
3693 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3694 self->addEqual(aaaa);
3695 Py_XINCREF(trueSelf);
3699 throw INTERP_KERNEL::Exception(msg);
3703 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3705 const char msg[]="Unexpected situation in __sub__ !";
3708 std::vector<int> aa;
3709 DataArrayIntTuple *aaa;
3711 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3716 MCAuto<DataArrayInt> ret=self->deepCopy();
3717 ret->applyLin(1,-val);
3722 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3723 return DataArrayInt::Substract(self,aaaa);
3727 return DataArrayInt::Substract(self,a);
3731 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3732 return DataArrayInt::Substract(self,aaaa);
3735 throw INTERP_KERNEL::Exception(msg);
3739 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3741 const char msg[]="Unexpected situation in __rsub__ !";
3744 std::vector<int> aa;
3745 DataArrayIntTuple *aaa;
3747 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3752 MCAuto<DataArrayInt> ret=self->deepCopy();
3753 ret->applyLin(-1,val);
3758 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3759 return DataArrayInt::Substract(aaaa,self);
3763 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3764 return DataArrayInt::Substract(aaaa,self);
3767 throw INTERP_KERNEL::Exception(msg);
3771 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3773 const char msg[]="Unexpected situation in __isub__ !";
3776 std::vector<int> aa;
3777 DataArrayIntTuple *aaa;
3779 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3784 self->applyLin(1,-val);
3785 Py_XINCREF(trueSelf);
3790 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3791 self->substractEqual(bb);
3792 Py_XINCREF(trueSelf);
3797 self->substractEqual(a);
3798 Py_XINCREF(trueSelf);
3803 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3804 self->substractEqual(aaaa);
3805 Py_XINCREF(trueSelf);
3809 throw INTERP_KERNEL::Exception(msg);
3813 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3815 const char msg[]="Unexpected situation in __mul__ !";
3818 std::vector<int> aa;
3819 DataArrayIntTuple *aaa;
3821 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3826 MCAuto<DataArrayInt> ret=self->deepCopy();
3827 ret->applyLin(val,0);
3832 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3833 return DataArrayInt::Multiply(self,aaaa);
3837 return DataArrayInt::Multiply(self,a);
3841 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3842 return DataArrayInt::Multiply(self,aaaa);
3845 throw INTERP_KERNEL::Exception(msg);
3849 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3851 const char msg[]="Unexpected situation in __rmul__ !";
3854 std::vector<int> aa;
3855 DataArrayIntTuple *aaa;
3857 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3862 MCAuto<DataArrayInt> ret=self->deepCopy();
3863 ret->applyLin(val,0);
3868 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3869 return DataArrayInt::Multiply(self,aaaa);
3873 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3874 return DataArrayInt::Multiply(self,aaaa);
3877 throw INTERP_KERNEL::Exception(msg);
3881 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3883 const char msg[]="Unexpected situation in __imul__ !";
3886 std::vector<int> aa;
3887 DataArrayIntTuple *aaa;
3889 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3894 self->applyLin(val,0);
3895 Py_XINCREF(trueSelf);
3900 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3901 self->multiplyEqual(bb);
3902 Py_XINCREF(trueSelf);
3907 self->multiplyEqual(a);
3908 Py_XINCREF(trueSelf);
3913 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3914 self->multiplyEqual(aaaa);
3915 Py_XINCREF(trueSelf);
3919 throw INTERP_KERNEL::Exception(msg);
3923 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3925 const char msg[]="Unexpected situation in __div__ !";
3928 std::vector<int> aa;
3929 DataArrayIntTuple *aaa;
3931 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3936 MCAuto<DataArrayInt> ret=self->deepCopy();
3937 ret->applyDivideBy(val);
3942 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3943 return DataArrayInt::Divide(self,aaaa);
3947 return DataArrayInt::Divide(self,a);
3951 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3952 return DataArrayInt::Divide(self,aaaa);
3955 throw INTERP_KERNEL::Exception(msg);
3959 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3961 const char msg[]="Unexpected situation in __rdiv__ !";
3964 std::vector<int> aa;
3965 DataArrayIntTuple *aaa;
3967 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3972 MCAuto<DataArrayInt> ret=self->deepCopy();
3978 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3979 return DataArrayInt::Divide(aaaa,self);
3983 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3984 return DataArrayInt::Divide(aaaa,self);
3987 throw INTERP_KERNEL::Exception(msg);
3991 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3993 const char msg[]="Unexpected situation in __idiv__ !";
3996 std::vector<int> aa;
3997 DataArrayIntTuple *aaa;
3999 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4004 self->applyDivideBy(val);
4005 Py_XINCREF(trueSelf);
4010 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4011 self->divideEqual(bb);
4012 Py_XINCREF(trueSelf);
4017 self->divideEqual(a);
4018 Py_XINCREF(trueSelf);
4023 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4024 self->divideEqual(aaaa);
4025 Py_XINCREF(trueSelf);
4029 throw INTERP_KERNEL::Exception(msg);
4033 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4035 const char msg[]="Unexpected situation in __mod__ !";
4038 std::vector<int> aa;
4039 DataArrayIntTuple *aaa;
4041 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4046 MCAuto<DataArrayInt> ret=self->deepCopy();
4047 ret->applyModulus(val);
4052 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4053 return DataArrayInt::Modulus(self,aaaa);
4057 return DataArrayInt::Modulus(self,a);
4061 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4062 return DataArrayInt::Modulus(self,aaaa);
4065 throw INTERP_KERNEL::Exception(msg);
4069 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4071 const char msg[]="Unexpected situation in __rmod__ !";
4074 std::vector<int> aa;
4075 DataArrayIntTuple *aaa;
4077 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4082 MCAuto<DataArrayInt> ret=self->deepCopy();
4083 ret->applyRModulus(val);
4088 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4089 return DataArrayInt::Modulus(aaaa,self);
4093 return DataArrayInt::Modulus(a,self);
4097 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4098 return DataArrayInt::Modulus(aaaa,self);
4101 throw INTERP_KERNEL::Exception(msg);
4105 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4107 const char msg[]="Unexpected situation in __imod__ !";
4110 std::vector<int> aa;
4111 DataArrayIntTuple *aaa;
4113 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4118 self->applyModulus(val);
4119 Py_XINCREF(trueSelf);
4124 self->modulusEqual(a);
4125 Py_XINCREF(trueSelf);
4130 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4131 self->modulusEqual(aaaa);
4132 Py_XINCREF(trueSelf);
4136 throw INTERP_KERNEL::Exception(msg);
4140 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4142 const char msg[]="Unexpected situation in __pow__ !";
4145 std::vector<int> aa;
4146 DataArrayIntTuple *aaa;
4148 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4153 MCAuto<DataArrayInt> ret=self->deepCopy();
4159 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4160 return DataArrayInt::Pow(self,aaaa);
4164 return DataArrayInt::Pow(self,a);
4168 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4169 return DataArrayInt::Pow(self,aaaa);
4172 throw INTERP_KERNEL::Exception(msg);
4176 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4178 const char msg[]="Unexpected situation in __rpow__ !";
4181 std::vector<int> aa;
4182 DataArrayIntTuple *aaa;
4184 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4189 MCAuto<DataArrayInt> ret=self->deepCopy();
4190 ret->applyRPow(val);
4195 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4196 return DataArrayInt::Pow(aaaa,self);
4200 return DataArrayInt::Pow(a,self);
4204 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4205 return DataArrayInt::Pow(aaaa,self);
4208 throw INTERP_KERNEL::Exception(msg);
4212 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4214 const char msg[]="Unexpected situation in __ipow__ !";
4217 std::vector<int> aa;
4218 DataArrayIntTuple *aaa;
4220 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4225 self->applyPow(val);
4226 Py_XINCREF(trueSelf);
4232 Py_XINCREF(trueSelf);
4237 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4238 self->powEqual(aaaa);
4239 Py_XINCREF(trueSelf);
4243 throw INTERP_KERNEL::Exception(msg);
4247 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4249 std::ostringstream oss;
4250 self->reprQuickOverview(oss);
4254 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4256 int szArr,sw,iTypppArr;
4257 std::vector<int> stdvecTyyppArr;
4258 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4259 self->pushBackValsSilent(tmp,tmp+szArr);
4262 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4264 std::vector<int> ret1;
4265 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4266 std::size_t sz=ret0.size();
4267 PyObject *pyRet=PyTuple_New(2);
4268 PyObject *pyRet0=PyList_New((int)sz);
4269 PyObject *pyRet1=PyList_New((int)sz);
4270 for(std::size_t i=0;i<sz;i++)
4272 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4273 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4275 PyTuple_SetItem(pyRet,0,pyRet0);
4276 PyTuple_SetItem(pyRet,1,pyRet1);
4280 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4282 DataArrayInt *ret0=0,*ret1=0;
4283 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4284 PyObject *pyRet=PyTuple_New(2);
4285 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4286 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4290 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4293 bool ret(self->isRange(a,b,c));
4294 PyObject *pyRet=PyTuple_New(2);
4295 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4297 PyTuple_SetItem(pyRet,0,ret0Py);
4299 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4305 PyTuple_SetItem(pyRet,1,ret1Py);
4310 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4312 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4315 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4318 if(!self->isAllocated())
4319 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4320 PyObject *ret(PyTuple_New(1));
4321 PyObject *ret0(PyDict_New());
4322 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4323 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4324 PyObject *tmp1(PyInt_FromLong(0));
4325 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4326 PyTuple_SetItem(ret,0,ret0);
4330 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4336 class DataArrayIntTuple;
4338 class DataArrayIntIterator
4341 DataArrayIntIterator(DataArrayInt *da);
4342 ~DataArrayIntIterator();
4347 DataArrayIntTuple *ret=self->nextt();
4349 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4352 PyErr_SetString(PyExc_StopIteration,"No more data.");
4359 class DataArrayIntTuple
4362 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4363 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4366 std::string __str__() const throw(INTERP_KERNEL::Exception)
4368 return self->repr();
4371 int __int__() const throw(INTERP_KERNEL::Exception)
4373 return self->intValue();
4376 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4378 return self->buildDAInt(1,self->getNumberOfCompo());
4381 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4383 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4384 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4385 Py_XINCREF(trueSelf);
4389 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4391 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4392 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4393 Py_XINCREF(trueSelf);
4397 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4399 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4400 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4401 Py_XINCREF(trueSelf);
4404 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4406 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4407 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4408 Py_XINCREF(trueSelf);
4412 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4414 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4415 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4416 Py_XINCREF(trueSelf);
4420 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4422 return PyInt_FromLong(self->getNumberOfCompo());
4425 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4427 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4430 std::vector<int> multiVal;
4431 std::pair<int, std::pair<int,int> > slic;
4432 MEDCoupling::DataArrayInt *daIntTyypp=0;
4433 const int *pt=self->getConstPointer();
4434 int nbc=self->getNumberOfCompo();
4435 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4442 std::ostringstream oss;
4443 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4444 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4448 return PyInt_FromLong(pt[singleVal]);
4452 return PyInt_FromLong(pt[nbc+singleVal]);
4455 std::ostringstream oss;
4456 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4457 throw INTERP_KERNEL::Exception(oss.str().c_str());
4463 PyObject *t=PyTuple_New(multiVal.size());
4464 for(int j=0;j<(int)multiVal.size();j++)
4466 int cid=multiVal[j];
4469 std::ostringstream oss;
4470 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4471 throw INTERP_KERNEL::Exception(oss.str().c_str());
4473 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4479 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4480 PyObject *t=PyTuple_New(sz);
4481 for(int j=0;j<sz;j++)
4482 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4486 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4490 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4492 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4493 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4496 std::vector<int> multiValV;
4497 std::pair<int, std::pair<int,int> > slicV;
4498 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4499 int nbc=self->getNumberOfCompo();
4500 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4502 std::vector<int> multiVal;
4503 std::pair<int, std::pair<int,int> > slic;
4504 MEDCoupling::DataArrayInt *daIntTyypp=0;
4505 int *pt=self->getPointer();
4506 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4513 std::ostringstream oss;
4514 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4515 throw INTERP_KERNEL::Exception(oss.str().c_str());
4521 pt[singleVal]=singleValV;
4526 if(multiValV.size()!=1)
4528 std::ostringstream oss;
4529 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4530 throw INTERP_KERNEL::Exception(oss.str().c_str());
4532 pt[singleVal]=multiValV[0];
4537 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4541 throw INTERP_KERNEL::Exception(msg);
4550 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4554 std::ostringstream oss;
4555 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4556 throw INTERP_KERNEL::Exception(oss.str().c_str());
4564 if(multiVal.size()!=multiValV.size())
4566 std::ostringstream oss;
4567 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4568 throw INTERP_KERNEL::Exception(oss.str().c_str());
4570 for(int i=0;i<(int)multiVal.size();i++)
4572 int pos=multiVal[i];
4575 std::ostringstream oss;
4576 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4577 throw INTERP_KERNEL::Exception(oss.str().c_str());
4579 pt[multiVal[i]]=multiValV[i];
4585 const int *ptV=daIntTyyppV->getConstPointer();
4586 if(nbc>daIntTyyppV->getNumberOfCompo())
4588 std::ostringstream oss;
4589 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4590 throw INTERP_KERNEL::Exception(oss.str().c_str());
4592 std::copy(ptV,ptV+nbc,pt);
4596 throw INTERP_KERNEL::Exception(msg);
4601 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4606 for(int j=0;j<sz;j++)
4607 pt[slic.first+j*slic.second.second]=singleValV;
4612 if(sz!=(int)multiValV.size())
4614 std::ostringstream oss;
4615 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4616 throw INTERP_KERNEL::Exception(oss.str().c_str());
4618 for(int j=0;j<sz;j++)
4619 pt[slic.first+j*slic.second.second]=multiValV[j];
4624 const int *ptV=daIntTyyppV->getConstPointer();
4625 if(sz>daIntTyyppV->getNumberOfCompo())
4627 std::ostringstream oss;
4628 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4629 throw INTERP_KERNEL::Exception(oss.str().c_str());
4631 for(int j=0;j<sz;j++)
4632 pt[slic.first+j*slic.second.second]=ptV[j];
4636 throw INTERP_KERNEL::Exception(msg);
4640 throw INTERP_KERNEL::Exception(msg);
4646 class DataArrayChar : public DataArray
4649 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4650 int getHashCode() const throw(INTERP_KERNEL::Exception);
4651 bool empty() const throw(INTERP_KERNEL::Exception);
4652 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4653 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4654 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4655 char popBackSilent() throw(INTERP_KERNEL::Exception);
4656 void pack() const throw(INTERP_KERNEL::Exception);
4657 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4658 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4659 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4660 void reverse() throw(INTERP_KERNEL::Exception);
4661 void fillWithZero() throw(INTERP_KERNEL::Exception);
4662 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4663 std::string repr() const throw(INTERP_KERNEL::Exception);
4664 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4665 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4666 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4667 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4668 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4669 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4670 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4671 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4672 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4673 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4674 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4675 char front() const throw(INTERP_KERNEL::Exception);
4676 char back() const throw(INTERP_KERNEL::Exception);
4677 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4678 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4679 char *getPointer() throw(INTERP_KERNEL::Exception);
4680 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4681 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4682 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4683 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4684 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4685 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4686 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4687 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4688 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4689 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4690 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4693 int __len__() const throw(INTERP_KERNEL::Exception)
4695 if(self->isAllocated())
4697 return self->getNumberOfTuples();
4701 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4705 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4708 bool ret0=self->isEqualIfNotWhy(other,ret1);
4709 PyObject *ret=PyTuple_New(2);
4710 PyObject *ret0Py=ret0?Py_True:Py_False;
4712 PyTuple_SetItem(ret,0,ret0Py);
4713 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4717 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4720 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4721 if (!SWIG_IsOK(res1))
4724 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4725 if(size!=self->getNumberOfTuples())
4727 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4729 return self->renumber(tmp);
4733 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4735 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4736 da2->checkAllocated();
4737 int size=self->getNumberOfTuples();
4738 if(size!=self->getNumberOfTuples())
4740 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4742 return self->renumber(da2->getConstPointer());
4746 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4749 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4750 if (!SWIG_IsOK(res1))
4753 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4754 if(size!=self->getNumberOfTuples())
4756 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4758 return self->renumberR(tmp);
4762 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4764 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4765 da2->checkAllocated();
4766 int size=self->getNumberOfTuples();
4767 if(size!=self->getNumberOfTuples())
4769 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4771 return self->renumberR(da2->getConstPointer());
4775 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4778 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4779 if (!SWIG_IsOK(res1))
4782 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4783 if(size!=self->getNumberOfTuples())
4785 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4787 return self->renumberAndReduce(tmp,newNbOfTuple);
4791 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4793 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4794 da2->checkAllocated();
4795 int size=self->getNumberOfTuples();
4796 if(size!=self->getNumberOfTuples())
4798 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4800 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4804 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4806 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4807 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4808 return DataArrayChar::Aggregate(tmp);
4811 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4813 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4814 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4815 return DataArrayChar::Meld(tmp);
4820 class DataArrayByteIterator;
4822 class DataArrayByte : public DataArrayChar
4825 static DataArrayByte *New();
4826 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4827 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4828 char byteValue() const throw(INTERP_KERNEL::Exception);
4831 DataArrayByte() throw(INTERP_KERNEL::Exception)
4833 return DataArrayByte::New();
4836 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4838 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) !";
4839 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4843 if(PyInt_Check(nbOfTuples))
4845 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4847 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4850 if(PyInt_Check(nbOfComp))
4851 {//DataArrayByte.New([1,3,4,5],2,2)
4852 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4854 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4855 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4856 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4857 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4861 throw INTERP_KERNEL::Exception(msg);
4864 {//DataArrayByte.New([1,3,4],3)
4865 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4867 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4868 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4873 throw INTERP_KERNEL::Exception(msg);
4876 {// DataArrayByte.New([1,3,4])
4877 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4878 int tmpp1=-1,tmpp2=-1;
4879 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4880 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4884 else if(PyInt_Check(elt0))
4886 int nbOfTuples1=PyInt_AS_LONG(elt0);
4888 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4893 if(PyInt_Check(nbOfTuples))
4894 {//DataArrayByte.New(5,2)
4895 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4897 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4898 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4899 ret->alloc(nbOfTuples1,nbOfCompo);
4903 throw INTERP_KERNEL::Exception(msg);
4906 throw INTERP_KERNEL::Exception(msg);
4909 {//DataArrayByte.New(5)
4910 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4911 ret->alloc(nbOfTuples1,1);
4916 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4917 {//DataArrayDouble.New(numpyArray)
4918 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4922 throw INTERP_KERNEL::Exception(msg);
4925 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4927 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4930 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4932 std::ostringstream oss;
4933 self->reprQuickOverview(oss);
4937 int __int__() const throw(INTERP_KERNEL::Exception)
4939 return (int) self->byteValue();
4942 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4944 return self->iterator();
4947 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4949 return (int)self->getIJ(tupleId,compoId);
4952 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4954 return (int)self->getIJSafe(tupleId,compoId);
4957 std::string __str__() const throw(INTERP_KERNEL::Exception)
4959 return self->repr();
4962 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4964 const char *vals=self->getConstPointer();
4965 int nbOfComp=self->getNumberOfComponents();
4966 int nbOfTuples=self->getNumberOfTuples();
4967 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4970 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4973 int ival=-1; std::vector<int> ivval;
4974 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4975 std::vector<char> vals(sz);
4976 std::copy(pt,pt+sz,vals.begin());
4977 return self->presenceOfTuple(vals);
4980 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4983 int ival=-1; std::vector<int> ivval;
4984 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4985 std::vector<char> vals2(sz);
4986 std::copy(pt,pt+sz,vals2.begin());
4987 return self->presenceOfValue(vals2);
4990 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4993 int ival=-1; std::vector<int> ivval;
4994 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4995 std::vector<char> vals2(sz);
4996 std::copy(pt,pt+sz,vals2.begin());
4997 return self->findIdFirstEqual(vals2);
5000 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5003 int ival=-1; std::vector<int> ivval;
5004 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
5005 std::vector<char> vals(sz);
5006 std::copy(pt,pt+sz,vals.begin());
5007 return self->findIdFirstEqualTuple(vals);
5010 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5013 int ival=-1; std::vector<int> ivval;
5014 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
5015 std::vector<char> vals(sz);
5016 std::copy(pt,pt+sz,vals.begin());
5017 return self->findIdSequence(vals);
5020 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5022 int sz=self->getNumberOfComponents();
5023 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5024 self->getTuple(tupleId,tmp);
5025 PyObject *ret=PyTuple_New(sz);
5026 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5030 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5033 int r1=(int)self->getMaxValue(tmp);
5034 PyObject *ret=PyTuple_New(2);
5035 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5036 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5040 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5043 int r1=(int)self->getMinValue(tmp);
5044 PyObject *ret=PyTuple_New(2);
5045 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5046 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5050 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5052 int nbOfCompo=self->getNumberOfComponents();
5057 if(PyInt_Check(obj))
5059 int val=(int)PyInt_AS_LONG(obj);
5060 return self->findIdFirstEqual(val);
5063 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5066 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5070 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5072 int nbOfCompo=self->getNumberOfComponents();
5079 if(PyInt_Check(obj))
5081 int val=(int)PyInt_AS_LONG(obj);
5082 return self->presenceOfValue(val);
5085 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5088 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5093 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5095 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5100 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5102 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5105 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5108 if(!self->isAllocated())
5109 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5110 PyObject *ret(PyTuple_New(1));
5111 PyObject *ret0(PyDict_New());
5112 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5113 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5114 PyObject *tmp1(PyInt_FromLong(0));
5115 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5116 PyTuple_SetItem(ret,0,ret0);
5120 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5124 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5126 self->checkAllocated();
5127 const char msg[]="Unexpected situation in __setitem__ !";
5128 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5131 std::vector<int> v1;
5133 DataArrayIntTuple *dd1=0;
5134 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5136 std::vector<int> vt1,vc1;
5137 std::pair<int, std::pair<int,int> > pt1,pc1;
5138 DataArrayInt *dt1=0,*dc1=0;
5139 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5140 MCAuto<DataArrayInt> tmp;
5148 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5151 throw INTERP_KERNEL::Exception(msg);
5160 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5163 throw INTERP_KERNEL::Exception(msg);
5172 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5175 throw INTERP_KERNEL::Exception(msg);
5184 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5187 throw INTERP_KERNEL::Exception(msg);
5196 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5199 throw INTERP_KERNEL::Exception(msg);
5208 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5211 throw INTERP_KERNEL::Exception(msg);
5220 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5223 throw INTERP_KERNEL::Exception(msg);
5232 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5235 throw INTERP_KERNEL::Exception(msg);
5244 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5247 throw INTERP_KERNEL::Exception(msg);
5256 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5259 throw INTERP_KERNEL::Exception(msg);
5268 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5271 throw INTERP_KERNEL::Exception(msg);
5280 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5283 throw INTERP_KERNEL::Exception(msg);
5292 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5295 throw INTERP_KERNEL::Exception(msg);
5304 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5307 throw INTERP_KERNEL::Exception(msg);
5316 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5319 throw INTERP_KERNEL::Exception(msg);
5328 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5331 throw INTERP_KERNEL::Exception(msg);
5336 throw INTERP_KERNEL::Exception(msg);
5343 class DataArrayByteTuple;
5345 class DataArrayByteIterator
5348 DataArrayByteIterator(DataArrayByte *da);
5349 ~DataArrayByteIterator();
5352 class DataArrayByteTuple
5355 std::string repr() const throw(INTERP_KERNEL::Exception);
5356 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5359 std::string __str__() const throw(INTERP_KERNEL::Exception)
5361 return self->repr();
5364 char __int__() const throw(INTERP_KERNEL::Exception)
5366 return self->byteValue();
5369 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5371 return self->buildDAByte(1,self->getNumberOfCompo());
5376 class DataArrayAsciiCharIterator;
5378 class DataArrayAsciiChar : public DataArrayChar
5381 static DataArrayAsciiChar *New();
5382 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5383 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5384 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5387 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5389 return DataArrayAsciiChar::New();
5392 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5394 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) !";
5395 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5399 if(PyInt_Check(nbOfTuples))
5401 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5403 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5406 if(PyInt_Check(nbOfComp))
5407 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5408 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5410 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5411 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5412 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5413 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5417 throw INTERP_KERNEL::Exception(msg);
5420 {//DataArrayAsciiChar.New([1,3,4],3)
5421 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5423 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5424 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5428 else if(PyString_Check(nbOfTuples))
5430 if(PyString_Size(nbOfTuples)!=1)
5431 throw INTERP_KERNEL::Exception(msg);
5432 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5433 std::vector<std::string> tmp;
5434 if(fillStringVector(elt0,tmp))
5435 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5437 throw INTERP_KERNEL::Exception(msg);
5439 %#if PY_VERSION_HEX >= 0x03000000
5440 else if(PyUnicode_Check(nbOfTuples))
5442 if(PyUnicode_GET_LENGTH(nbOfTuples)!=1)
5443 throw INTERP_KERNEL::Exception(msg);
5444 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5445 std::vector<std::string> tmp;
5446 if(fillStringVector(elt0,tmp))
5447 return DataArrayAsciiChar::New(tmp,PyUnicode_AsUTF8(nbOfTuples)[0]);
5449 throw INTERP_KERNEL::Exception(msg);
5453 throw INTERP_KERNEL::Exception(msg);
5457 std::vector<std::string> tmmp;
5458 if(fillStringVector(elt0,tmmp))
5459 //DataArrayAsciiChar.New(["abc","de","fghi"])
5460 return DataArrayAsciiChar::New(tmmp,' ');
5463 // DataArrayAsciiChar.New([1,3,4])
5464 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5465 int tmpp1=-1,tmpp2=-1;
5466 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5467 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5472 else if(PyInt_Check(elt0))
5474 int nbOfTuples1=PyInt_AS_LONG(elt0);
5476 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5481 if(PyInt_Check(nbOfTuples))
5482 {//DataArrayAsciiChar.New(5,2)
5483 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5485 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5486 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5487 ret->alloc(nbOfTuples1,nbOfCompo);
5491 throw INTERP_KERNEL::Exception(msg);
5494 throw INTERP_KERNEL::Exception(msg);
5497 {//DataArrayAsciiChar.New(5)
5498 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5499 ret->alloc(nbOfTuples1,1);
5504 throw INTERP_KERNEL::Exception(msg);
5507 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5509 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5512 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5514 std::ostringstream oss;
5515 self->reprQuickOverview(oss);
5519 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5521 return self->iterator();
5524 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5526 char tmp[2]; tmp[1]='\0';
5527 tmp[0]=self->getIJ(tupleId,compoId);
5528 return std::string(tmp);
5531 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5533 char tmp[2]; tmp[1]='\0';
5534 tmp[0]=self->getIJSafe(tupleId,compoId);
5535 return std::string(tmp);
5538 std::string __str__() const throw(INTERP_KERNEL::Exception)
5540 return self->repr();
5543 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5545 const char *vals=self->getConstPointer();
5546 int nbOfComp=self->getNumberOfComponents();
5547 int nbOfTuples=self->getNumberOfTuples();
5548 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5551 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5553 if(PyString_Check(tupl))
5555 Py_ssize_t sz=PyString_Size(tupl);
5556 std::vector<char> vals(sz);
5557 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5558 return self->presenceOfTuple(vals);
5560 %#if PY_VERSION_HEX >= 0x03000000
5561 else if(PyUnicode_Check(tupl))
5563 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5564 std::vector<char> vals(sz);
5565 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5566 return self->presenceOfTuple(vals);
5570 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5573 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5575 if(PyString_Check(vals))
5577 Py_ssize_t sz=PyString_Size(vals);
5578 std::vector<char> vals2(sz);
5579 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5580 return self->presenceOfValue(vals2);
5582 %#if PY_VERSION_HEX >= 0x03000000
5583 if(PyUnicode_Check(vals))
5585 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5586 std::vector<char> vals2(sz);
5587 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5588 return self->presenceOfValue(vals2);
5592 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5595 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5597 if(PyString_Check(vals))
5599 Py_ssize_t sz=PyString_Size(vals);
5600 std::vector<char> vals2(sz);
5601 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5602 return self->findIdFirstEqual(vals2);
5604 %#if PY_VERSION_HEX >= 0x03000000
5605 if(PyUnicode_Check(vals))
5607 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5608 std::vector<char> vals2(sz);
5609 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5610 return self->findIdFirstEqual(vals2);
5614 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5617 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5619 if(PyString_Check(tupl))
5621 Py_ssize_t sz=PyString_Size(tupl);
5622 std::vector<char> vals(sz);
5623 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5624 return self->findIdFirstEqualTuple(vals);
5626 %#if PY_VERSION_HEX >= 0x03000000
5627 if(PyUnicode_Check(tupl))
5629 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5630 std::vector<char> vals(sz);
5631 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5632 return self->findIdFirstEqualTuple(vals);
5636 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5639 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5641 if(PyString_Check(strOrListOfInt))
5643 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5644 std::vector<char> vals(sz);
5645 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5646 return self->findIdSequence(vals);
5648 %#if PY_VERSION_HEX >= 0x03000000
5649 else if(PyUnicode_Check(strOrListOfInt))
5651 Py_ssize_t sz=PyUnicode_GET_LENGTH(strOrListOfInt);
5652 std::vector<char> vals(sz);
5653 std::copy(PyUnicode_AsUTF8(strOrListOfInt),PyUnicode_AsUTF8(strOrListOfInt)+sz,vals.begin());
5654 return self->findIdSequence(vals);
5658 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5661 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5663 int sz=self->getNumberOfComponents();
5664 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5665 self->getTuple(tupleId,tmp);
5666 return PyString_FromString(tmp);
5669 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5672 char tmp2[2]; tmp2[1]='\0';
5673 tmp2[0]=self->getMaxValue(tmp);
5674 PyObject *ret=PyTuple_New(2);
5675 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5676 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5680 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5683 char tmp2[2]; tmp2[1]='\0';
5684 tmp2[0]=self->getMinValue(tmp);
5685 PyObject *ret=PyTuple_New(2);
5686 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5687 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5691 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5693 int nbOfCompo=self->getNumberOfComponents();
5698 if(PyString_Check(obj))
5700 Py_ssize_t sz=PyString_Size(obj);
5701 char *pt=PyString_AsString(obj);
5703 return self->findIdFirstEqual(pt[0]);
5705 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5707 %#if PY_VERSION_HEX >= 0x03000000
5708 if(PyUnicode_Check(obj))
5711 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
5713 return self->findIdFirstEqual(pt[0]);
5715 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5719 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5722 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5726 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5728 int nbOfCompo=self->getNumberOfComponents();
5735 if(PyString_Check(obj))
5737 Py_ssize_t sz=PyString_Size(obj);
5738 char *pt=PyString_AsString(obj);
5740 return self->presenceOfValue(pt[0]);
5742 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5744 %#if PY_VERSION_HEX >= 0x03000000
5745 if(PyUnicode_Check(obj))
5748 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
5750 return self->presenceOfValue(pt[0]);
5752 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5756 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5759 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5763 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5766 std::vector<int> stdvecTyyppArr;
5767 std::pair<int, std::pair<int,int> > sTyyppArr;
5768 MEDCoupling::DataArrayInt *daIntTyypp=0;
5769 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5773 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5775 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5777 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5779 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5781 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5785 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5787 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.";
5789 std::vector<int> stdvecTyyppArr;
5790 std::pair<int, std::pair<int,int> > sTyyppArr;
5791 MEDCoupling::DataArrayInt *daIntTyypp=0;
5792 int nbOfCompo=self->getNumberOfComponents();
5793 int nbOfTuples=self->getNumberOfTuples();
5794 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5796 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5797 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5806 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5812 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5813 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5816 //value vector<string>
5819 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5820 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5823 //value DataArrayChar
5826 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5830 throw INTERP_KERNEL::Exception(msg);
5834 {//obj list-tuple[int]
5840 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5846 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5847 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5850 //value vector<string>
5853 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5854 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5857 //value DataArrayChar
5860 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5864 throw INTERP_KERNEL::Exception(msg);
5875 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5881 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5882 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5885 //value vector<string>
5888 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5889 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5892 //value DataArrayChar
5895 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5899 throw INTERP_KERNEL::Exception(msg);
5910 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5916 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5917 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5920 //value vector<string>
5923 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5924 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5927 //value DataArrayChar
5930 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5934 throw INTERP_KERNEL::Exception(msg);
5939 throw INTERP_KERNEL::Exception(msg);
5945 class DataArrayAsciiCharTuple;
5947 class DataArrayAsciiCharIterator
5950 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5951 ~DataArrayAsciiCharIterator();
5956 DataArrayAsciiCharTuple *ret=self->nextt();
5958 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5961 PyErr_SetString(PyExc_StopIteration,"No more data.");
5968 class DataArrayAsciiCharTuple
5971 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5972 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5975 std::string __str__() const throw(INTERP_KERNEL::Exception)
5977 return self->repr();
5980 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5982 return self->buildDAAsciiChar(1,self->getNumberOfCompo());