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 (CEA/DEN)
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 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
581 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
583 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
584 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
587 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
589 if(!PySlice_Check(slic))
590 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
591 Py_ssize_t strt=2,stp=2,step=2;
592 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
593 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
595 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
596 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
599 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
601 if(!PySlice_Check(slic))
602 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
603 Py_ssize_t strt=2,stp=2,step=2;
604 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
605 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
606 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
609 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
611 if(!PySlice_Check(slic))
612 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
613 Py_ssize_t strt=2,stp=2,step=2;
614 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
615 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
616 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
619 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
621 std::vector<const DataArray *> tmp;
622 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
623 return DataArray::Aggregate(tmp);
626 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
628 if(!PySlice_Check(slic))
629 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
630 Py_ssize_t strt=2,stp=2,step=2;
631 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
632 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
633 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
636 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
638 if(!PySlice_Check(slic))
639 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
640 Py_ssize_t strt=2,stp=2,step=2;
641 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
642 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
643 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
646 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
648 PyObject *ret(PyTuple_New(2));
649 std::string a0(self->getName());
650 const std::vector<std::string> &a1(self->getInfoOnComponents());
651 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
654 PyObject *ret1(PyList_New(sz));
655 for(int i=0;i<sz;i++)
656 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
657 PyTuple_SetItem(ret,1,ret1);
662 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
664 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 !";
665 if(!PyTuple_Check(inp))
666 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
667 int sz(PyTuple_Size(inp));
669 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
670 PyObject *a0(PyTuple_GetItem(inp,0));
671 if(!PyString_Check(a0))
672 throw INTERP_KERNEL::Exception(MSG);
673 PyObject *a1(PyTuple_GetItem(inp,1));
674 std::vector<std::string> a1cpp;
675 if(!fillStringVector(a1,a1cpp))
676 throw INTERP_KERNEL::Exception(MSG);
677 self->setName(PyString_AsString(a0));
678 self->setInfoOnComponents(a1cpp);
683 class DataArrayDouble;
685 class DataArrayFloat : public DataArray
688 static DataArrayFloat *New();
689 void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
690 bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
691 bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
692 bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
693 void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
694 void iota(float init=0.) throw(INTERP_KERNEL::Exception);
695 DataArrayFloatIterator *iterator() throw(INTERP_KERNEL::Exception);
696 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
697 static DataArrayFloat *Meld(const DataArrayFloat *a1, const DataArrayFloat *a2) throw(INTERP_KERNEL::Exception);
700 DataArrayFloat() throw(INTERP_KERNEL::Exception)
702 return DataArrayFloat::New();
705 static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
707 return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
710 DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
712 return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
715 DataArrayFloatIterator *__iter__() throw(INTERP_KERNEL::Exception)
717 return self->iterator();
720 std::string __repr__() const throw(INTERP_KERNEL::Exception)
722 std::ostringstream oss;
723 self->reprQuickOverview(oss);
727 std::string __str__() const throw(INTERP_KERNEL::Exception)
729 return self->reprNotTooLong();
732 int __len__() const throw(INTERP_KERNEL::Exception)
734 if(self->isAllocated())
736 return self->getNumberOfTuples();
740 throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
744 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
746 const float *vals(self->begin());
747 return convertDblArrToPyList<float>(vals,self->getNbOfElems());
750 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
752 const float *vals(self->begin());
753 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
754 return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
757 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
759 return DataArrayT__getitem<float>(self,obj);
762 DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
764 return DataArrayT__setitem__<float>(self,obj,value);
767 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
769 return DataArrayT_iadd<float>(trueSelf,obj,self);
772 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
774 return DataArrayT_isub<float>(trueSelf,obj,self);
777 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
779 return DataArrayT_imul<float>(trueSelf,obj,self);
782 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
784 return DataArrayT_idiv<float>(trueSelf,obj,self);
788 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
790 return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
795 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
797 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayFloat");
800 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
803 if(!self->isAllocated())
804 throw INTERP_KERNEL::Exception("PyWrap of DataArrayFloat.__getnewargs__ : self is not allocated !");
805 PyObject *ret(PyTuple_New(1));
806 PyObject *ret0(PyDict_New());
807 PyObject *numpyArryObj(MEDCoupling_DataArrayFloat_toNumPyArray(self));
808 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
809 PyObject *tmp1(PyInt_FromLong(0));
810 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
811 PyTuple_SetItem(ret,0,ret0);
815 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
821 class DataArrayFloatTuple;
823 class DataArrayFloatIterator
826 DataArrayFloatIterator(DataArrayFloat *da);
827 ~DataArrayFloatIterator();
832 DataArrayFloatTuple *ret=self->nextt();
834 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple,SWIG_POINTER_OWN|0);
837 PyErr_SetString(PyExc_StopIteration,"No more data.");
844 class DataArrayFloatTuple
847 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
848 DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
851 std::string __str__() const throw(INTERP_KERNEL::Exception)
856 float __float__() const throw(INTERP_KERNEL::Exception)
858 return self->floatValue();
861 DataArrayFloat *buildDAFloat() throw(INTERP_KERNEL::Exception)
863 return self->buildDAFloat(1,self->getNumberOfCompo());
866 /*PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
868 MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
869 MEDCoupling_DataArrayFloat____imul___(ret,0,obj);
870 Py_XINCREF(trueSelf);
874 PyObject *__len__() throw(INTERP_KERNEL::Exception)
876 return PyInt_FromLong(self->getNumberOfCompo());
882 class DataArrayDoubleIterator;
884 class DataArrayDouble : public DataArray
887 static DataArrayDouble *New();
888 double doubleValue() const throw(INTERP_KERNEL::Exception);
889 bool empty() const throw(INTERP_KERNEL::Exception);
890 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
891 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
892 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
893 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
894 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
895 double popBackSilent() throw(INTERP_KERNEL::Exception);
896 void pack() const throw(INTERP_KERNEL::Exception);
897 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
898 void fillWithZero() throw(INTERP_KERNEL::Exception);
899 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
900 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
901 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
902 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
903 void reverse() throw(INTERP_KERNEL::Exception);
904 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
905 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
906 std::string repr() const throw(INTERP_KERNEL::Exception);
907 std::string reprZip() const throw(INTERP_KERNEL::Exception);
908 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
909 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
910 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
911 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
912 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
913 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
914 void transpose() throw(INTERP_KERNEL::Exception);
915 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
916 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
917 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
918 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
919 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
920 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
921 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
922 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
923 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
924 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
925 double front() const throw(INTERP_KERNEL::Exception);
926 double back() const throw(INTERP_KERNEL::Exception);
927 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
928 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
929 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
930 double *getPointer() throw(INTERP_KERNEL::Exception);
931 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
932 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
933 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
934 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
935 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
936 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
937 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
938 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
939 double getAverageValue() const throw(INTERP_KERNEL::Exception);
940 double norm2() const throw(INTERP_KERNEL::Exception);
941 double normMax() const throw(INTERP_KERNEL::Exception);
942 double normMin() const throw(INTERP_KERNEL::Exception);
943 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
944 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
945 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
946 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
947 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
948 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
949 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
950 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
951 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
952 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
953 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
954 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
955 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
956 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
957 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
958 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
959 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
960 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
961 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
962 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
963 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
964 void abs() throw(INTERP_KERNEL::Exception);
965 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
966 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
967 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
968 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
969 void applyPow(double val) throw(INTERP_KERNEL::Exception);
970 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
971 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
972 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
973 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
974 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
975 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
976 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
977 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
978 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
979 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
980 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
981 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
982 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
983 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
984 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
985 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
986 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
987 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
988 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
989 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
990 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
991 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
992 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
993 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
994 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
995 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
996 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
997 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
998 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
999 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
1000 MCAuto<DataArrayInt> findIdsGreaterThan(double val) const throw(INTERP_KERNEL::Exception);
1001 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
1002 MCAuto<DataArrayInt> findIdsLowerThan(double val) const throw(INTERP_KERNEL::Exception);
1003 MCAuto<DataArrayInt> convertToIntArr() const throw(INTERP_KERNEL::Exception);
1004 MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
1005 MCAuto<DataArrayDouble> cumSum() const throw(INTERP_KERNEL::Exception);
1006 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
1009 DataArrayDouble() throw(INTERP_KERNEL::Exception)
1011 return DataArrayDouble::New();
1014 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1016 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
1019 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1021 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
1024 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
1027 std::vector<double> bb;
1029 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
1030 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
1031 self->pushBackValsSilent(tmp,tmp+nbTuples);
1034 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1036 std::ostringstream oss;
1037 self->reprQuickOverview(oss);
1041 std::string __str__() const throw(INTERP_KERNEL::Exception)
1043 return self->reprNotTooLong();
1046 double __float__() const throw(INTERP_KERNEL::Exception)
1048 return self->doubleValue();
1051 int __len__() const throw(INTERP_KERNEL::Exception)
1053 if(self->isAllocated())
1055 return self->getNumberOfTuples();
1059 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
1063 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
1065 return self->iterator();
1068 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1070 const char *msg="MEDCoupling::DataArrayDouble::setValues : Available API are : \n-DataArrayDouble.setValues([1.,3.,4.])\n-DataArrayDouble.setValues([1.,3.,4.],3)\n-DataArrayDouble.setValues([1.,3.,4.,5.],2,2)\n-DataArrayDouble.setValues([(1.,1.7),(3.,3.7),(4.,4.7)])\n !";
1071 if(PyList_Check(li) || PyTuple_Check(li))
1075 if(PyInt_Check(nbOfTuples))
1077 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1079 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
1082 if(PyInt_Check(nbOfComp))
1083 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
1084 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1086 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
1087 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
1088 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1091 throw INTERP_KERNEL::Exception(msg);
1094 {//DataArrayDouble.setValues([1.,3.,4.],3)
1096 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
1097 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1101 throw INTERP_KERNEL::Exception(msg);
1104 {// DataArrayDouble.setValues([1.,3.,4.])
1105 int tmpp1=-1,tmpp2=-1;
1106 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
1107 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1111 throw INTERP_KERNEL::Exception(msg);
1114 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
1116 const double *vals(self->begin());
1117 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
1121 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
1123 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1127 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1130 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1131 PyObject *ret=PyTuple_New(2);
1132 PyObject *ret0Py=ret0?Py_True:Py_False;
1134 PyTuple_SetItem(ret,0,ret0Py);
1135 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1139 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1141 const double *vals(self->begin());
1142 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1143 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1146 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1148 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1150 DataArrayDouble *a,*a2;
1151 DataArrayDoubleTuple *aa,*aa2;
1152 std::vector<double> bb,bb2;
1154 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1155 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1156 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1160 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1162 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1164 DataArrayDouble *a,*a2;
1165 DataArrayDoubleTuple *aa,*aa2;
1166 std::vector<double> bb,bb2;
1168 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1170 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1171 return convertDblArrToPyListOfTuple<double>(res,3,3);
1174 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1176 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1178 DataArrayDouble *a,*a2;
1179 DataArrayDoubleTuple *aa,*aa2;
1180 std::vector<double> bb,bb2;
1182 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1183 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1184 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1187 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1190 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1191 if (!SWIG_IsOK(res1))
1194 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1195 if(size!=self->getNumberOfTuples())
1197 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1199 return self->renumber(tmp);
1203 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1205 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1206 da2->checkAllocated();
1207 int size=self->getNumberOfTuples();
1208 if(size!=self->getNumberOfTuples())
1210 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1212 return self->renumber(da2->getConstPointer());
1216 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1219 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1220 if (!SWIG_IsOK(res1))
1223 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1224 if(size!=self->getNumberOfTuples())
1226 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1228 return self->renumberR(tmp);
1232 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1234 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1235 da2->checkAllocated();
1236 int size=self->getNumberOfTuples();
1237 if(size!=self->getNumberOfTuples())
1239 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1241 return self->renumberR(da2->getConstPointer());
1245 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1248 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1249 if (!SWIG_IsOK(res1))
1252 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1253 if(size!=self->getNumberOfTuples())
1255 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1257 return self->renumberAndReduce(tmp,newNbOfTuple);
1261 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1263 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1264 da2->checkAllocated();
1265 int size=self->getNumberOfTuples();
1266 if(size!=self->getNumberOfTuples())
1268 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1270 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1274 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1276 int thisTupleId,otherTupleId;
1277 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1278 PyObject *ret=PyTuple_New(3);
1279 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1280 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1281 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1285 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1288 double r1=self->getMaxValue(tmp);
1289 PyObject *ret=PyTuple_New(2);
1290 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1291 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1295 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1298 double r1=self->getMaxValue2(tmp);
1299 PyObject *ret=PyTuple_New(2);
1300 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1301 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1305 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1308 double r1=self->getMinValue(tmp);
1309 PyObject *ret=PyTuple_New(2);
1310 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1311 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1315 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1318 double r1=self->getMinValue2(tmp);
1319 PyObject *ret=PyTuple_New(2);
1320 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1321 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1325 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1327 int nbOfCompo(self->getNumberOfComponents());
1328 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1329 self->getMinMaxPerComponent(tmp);
1330 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1334 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1336 int sz=self->getNumberOfComponents();
1337 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1338 self->accumulate(tmp);
1339 return convertDblArrToPyList<double>(tmp,sz);
1342 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1345 std::vector<int> val2;
1346 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1347 return self->accumulatePerChunck(bg,bg+sz);
1350 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1352 DataArrayInt *comm, *commIndex;
1353 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1354 PyObject *res = PyList_New(2);
1355 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1356 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1360 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1364 DataArrayDoubleTuple *aa;
1365 std::vector<double> bb;
1367 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1368 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1370 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1371 PyObject *ret=PyTuple_New(2);
1372 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1373 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1377 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1379 std::vector<int> tmp;
1380 convertPyToNewIntArr3(li,tmp);
1381 self->setSelectedComponents(a,tmp);
1384 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1386 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1387 std::size_t sz(retCpp.size());
1388 PyObject *res(PyList_New(sz));
1389 for(std::size_t i=0;i<sz;i++)
1390 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1394 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1396 int sz=self->getNumberOfComponents();
1397 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1398 self->getTuple(tupleId,tmp);
1399 return convertDblArrToPyList<double>(tmp,sz);
1402 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1404 std::vector<const DataArrayDouble *> tmp;
1405 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1406 return DataArrayDouble::Aggregate(tmp);
1409 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1411 std::vector<const DataArrayDouble *> tmp;
1412 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1413 return DataArrayDouble::Meld(tmp);
1416 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1420 DataArrayDoubleTuple *aa;
1421 std::vector<double> bb;
1423 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1424 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1425 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1426 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1427 DataArrayInt *c=0,*cI=0;
1428 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1429 PyObject *ret=PyTuple_New(2);
1430 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1431 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1435 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1437 DataArrayInt *ret1=0;
1438 bool ret0=self->areIncludedInMe(other,prec,ret1);
1439 PyObject *ret=PyTuple_New(2);
1440 PyObject *ret0Py=ret0?Py_True:Py_False;
1442 PyTuple_SetItem(ret,0,ret0Py);
1443 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1447 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1449 return DataArrayT__getitem<double>(self,obj);
1452 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1454 return DataArrayT__setitem__<double>(self,obj,value);
1457 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1459 return self->negate();
1462 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1464 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1467 DataArrayDoubleTuple *aa;
1468 std::vector<double> bb;
1471 #ifndef WITHOUT_AUTOFIELD
1473 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1475 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1478 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1479 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1481 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1484 throw INTERP_KERNEL::Exception(msg);
1488 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1493 MCAuto<DataArrayDouble> ret=self->deepCopy();
1494 ret->applyLin(1.,val);
1495 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1499 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1503 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1504 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1508 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1509 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1512 throw INTERP_KERNEL::Exception(msg);
1516 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1518 const char msg[]="Unexpected situation in __radd__ !";
1521 DataArrayDoubleTuple *aa;
1522 std::vector<double> bb;
1524 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1529 MCAuto<DataArrayDouble> ret=self->deepCopy();
1530 ret->applyLin(1.,val);
1535 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1536 return DataArrayDouble::Add(self,aaa);
1540 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1541 return DataArrayDouble::Add(self,aaa);
1544 throw INTERP_KERNEL::Exception(msg);
1548 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1550 return DataArrayT_iadd<double>(trueSelf,obj,self);
1553 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1555 const char msg[]="Unexpected situation in __sub__ !";
1558 DataArrayDoubleTuple *aa;
1559 std::vector<double> bb;
1562 #ifndef WITHOUT_AUTOFIELD
1564 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1566 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1569 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1570 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1572 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1575 throw INTERP_KERNEL::Exception(msg);
1579 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1584 MCAuto<DataArrayDouble> ret=self->deepCopy();
1585 ret->applyLin(1.,-val);
1586 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1590 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1594 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1595 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1599 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1600 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1603 throw INTERP_KERNEL::Exception(msg);
1607 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1609 const char msg[]="Unexpected situation in __rsub__ !";
1612 DataArrayDoubleTuple *aa;
1613 std::vector<double> bb;
1615 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1620 MCAuto<DataArrayDouble> ret=self->deepCopy();
1621 ret->applyLin(-1.,val);
1626 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1627 return DataArrayDouble::Substract(aaa,self);
1631 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1632 return DataArrayDouble::Substract(aaa,self);
1635 throw INTERP_KERNEL::Exception(msg);
1639 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1641 return DataArrayT_isub<double>(trueSelf,obj,self);
1644 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1646 const char msg[]="Unexpected situation in __mul__ !";
1649 DataArrayDoubleTuple *aa;
1650 std::vector<double> bb;
1653 #ifndef WITHOUT_AUTOFIELD
1655 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1657 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1660 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1661 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1663 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1666 throw INTERP_KERNEL::Exception(msg);
1670 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1675 MCAuto<DataArrayDouble> ret=self->deepCopy();
1676 ret->applyLin(val,0.);
1677 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1681 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1685 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1686 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1690 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1691 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1694 throw INTERP_KERNEL::Exception(msg);
1698 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1700 const char msg[]="Unexpected situation in __rmul__ !";
1703 DataArrayDoubleTuple *aa;
1704 std::vector<double> bb;
1706 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1711 MCAuto<DataArrayDouble> ret=self->deepCopy();
1712 ret->applyLin(val,0.);
1717 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1718 return DataArrayDouble::Multiply(self,aaa);
1722 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1723 return DataArrayDouble::Multiply(self,aaa);
1726 throw INTERP_KERNEL::Exception(msg);
1730 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1732 return DataArrayT_imul<double>(trueSelf,obj,self);
1735 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1737 const char msg[]="Unexpected situation in __div__ !";
1740 DataArrayDoubleTuple *aa;
1741 std::vector<double> bb;
1744 #ifndef WITHOUT_AUTOFIELD
1746 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1748 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1751 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1752 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1754 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1757 throw INTERP_KERNEL::Exception(msg);
1761 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1767 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1768 MCAuto<DataArrayDouble> ret=self->deepCopy();
1769 ret->applyLin(1/val,0.);
1770 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1774 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1778 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1779 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1783 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1784 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1787 throw INTERP_KERNEL::Exception(msg);
1791 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1793 const char msg[]="Unexpected situation in __rdiv__ !";
1796 DataArrayDoubleTuple *aa;
1797 std::vector<double> bb;
1799 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1804 MCAuto<DataArrayDouble> ret=self->deepCopy();
1810 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1811 return DataArrayDouble::Divide(aaa,self);
1815 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1816 return DataArrayDouble::Divide(aaa,self);
1819 throw INTERP_KERNEL::Exception(msg);
1823 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1825 return DataArrayT_idiv<double>(trueSelf,obj,self);
1828 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1830 const char msg[]="Unexpected situation in __pow__ !";
1833 DataArrayDoubleTuple *aa;
1834 std::vector<double> bb;
1836 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1841 MCAuto<DataArrayDouble> ret=self->deepCopy();
1847 return DataArrayDouble::Pow(self,a);
1851 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1852 return DataArrayDouble::Pow(self,aaa);
1856 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1857 return DataArrayDouble::Pow(self,aaa);
1860 throw INTERP_KERNEL::Exception(msg);
1864 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1866 const char msg[]="Unexpected situation in __rpow__ !";
1869 DataArrayDoubleTuple *aa;
1870 std::vector<double> bb;
1872 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1877 MCAuto<DataArrayDouble> ret=self->deepCopy();
1878 ret->applyRPow(val);
1883 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1884 return DataArrayDouble::Pow(aaa,self);
1888 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1889 return DataArrayDouble::Pow(aaa,self);
1892 throw INTERP_KERNEL::Exception(msg);
1896 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1898 const char msg[]="Unexpected situation in __ipow__ !";
1901 DataArrayDoubleTuple *aa;
1902 std::vector<double> bb;
1904 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1909 self->applyPow(val);
1910 Py_XINCREF(trueSelf);
1916 Py_XINCREF(trueSelf);
1921 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1922 self->powEqual(aaa);
1923 Py_XINCREF(trueSelf);
1928 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1929 self->powEqual(aaa);
1930 Py_XINCREF(trueSelf);
1934 throw INTERP_KERNEL::Exception(msg);
1938 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1940 DataArrayInt *c=0,*cI=0;
1942 self->computeTupleIdsNearTuples(other,eps,c,cI);
1943 PyObject *ret=PyTuple_New(2);
1944 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1945 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1949 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1951 DataArrayInt *ret1=0;
1952 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1953 PyObject *ret=PyTuple_New(2);
1954 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1955 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1960 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
1962 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
1965 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
1968 if(!self->isAllocated())
1969 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
1970 PyObject *ret(PyTuple_New(1));
1971 PyObject *ret0(PyDict_New());
1972 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
1973 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
1974 PyObject *tmp1(PyInt_FromLong(0));
1975 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
1976 PyTuple_SetItem(ret,0,ret0);
1980 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
1986 class DataArrayDoubleTuple;
1988 class DataArrayDoubleIterator
1991 DataArrayDoubleIterator(DataArrayDouble *da);
1992 ~DataArrayDoubleIterator();
1997 DataArrayDoubleTuple *ret=self->nextt();
1999 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2002 PyErr_SetString(PyExc_StopIteration,"No more data.");
2009 class DataArrayDoubleTuple
2012 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2013 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2016 std::string __str__() const throw(INTERP_KERNEL::Exception)
2018 return self->repr();
2021 double __float__() const throw(INTERP_KERNEL::Exception)
2023 return self->doubleValue();
2026 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2028 return self->buildDADouble(1,self->getNumberOfCompo());
2031 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2033 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2034 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2035 Py_XINCREF(trueSelf);
2039 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2041 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2042 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2043 Py_XINCREF(trueSelf);
2047 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2049 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2050 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2051 Py_XINCREF(trueSelf);
2055 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2057 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2058 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2059 Py_XINCREF(trueSelf);
2063 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2065 return PyInt_FromLong(self->getNumberOfCompo());
2068 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2070 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2073 std::vector<int> multiVal;
2074 std::pair<int, std::pair<int,int> > slic;
2075 MEDCoupling::DataArrayInt *daIntTyypp=0;
2076 const double *pt=self->getConstPointer();
2077 int nbc=self->getNumberOfCompo();
2078 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2085 std::ostringstream oss;
2086 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2087 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2091 return PyFloat_FromDouble(pt[singleVal]);
2095 return PyFloat_FromDouble(pt[nbc+singleVal]);
2098 std::ostringstream oss;
2099 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2100 throw INTERP_KERNEL::Exception(oss.str().c_str());
2106 PyObject *t=PyTuple_New(multiVal.size());
2107 for(int j=0;j<(int)multiVal.size();j++)
2109 int cid=multiVal[j];
2112 std::ostringstream oss;
2113 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2114 throw INTERP_KERNEL::Exception(oss.str().c_str());
2116 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2122 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2123 PyObject *t=PyTuple_New(sz);
2124 for(int j=0;j<sz;j++)
2125 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2129 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2133 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2135 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2136 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2139 std::vector<double> multiValV;
2140 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2141 int nbc=self->getNumberOfCompo();
2142 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2144 std::vector<int> multiVal;
2145 std::pair<int, std::pair<int,int> > slic;
2146 MEDCoupling::DataArrayInt *daIntTyypp=0;
2147 double *pt=self->getPointer();
2148 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2155 std::ostringstream oss;
2156 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2157 throw INTERP_KERNEL::Exception(oss.str().c_str());
2163 pt[singleVal]=singleValV;
2168 if(multiValV.size()!=1)
2170 std::ostringstream oss;
2171 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2172 throw INTERP_KERNEL::Exception(oss.str().c_str());
2174 pt[singleVal]=multiValV[0];
2179 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2183 throw INTERP_KERNEL::Exception(msg);
2192 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2196 std::ostringstream oss;
2197 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2198 throw INTERP_KERNEL::Exception(oss.str().c_str());
2206 if(multiVal.size()!=multiValV.size())
2208 std::ostringstream oss;
2209 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2210 throw INTERP_KERNEL::Exception(oss.str().c_str());
2212 for(int i=0;i<(int)multiVal.size();i++)
2214 int pos=multiVal[i];
2217 std::ostringstream oss;
2218 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2219 throw INTERP_KERNEL::Exception(oss.str().c_str());
2221 pt[multiVal[i]]=multiValV[i];
2227 const double *ptV=daIntTyyppV->getConstPointer();
2228 if(nbc>daIntTyyppV->getNumberOfCompo())
2230 std::ostringstream oss;
2231 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2232 throw INTERP_KERNEL::Exception(oss.str().c_str());
2234 std::copy(ptV,ptV+nbc,pt);
2238 throw INTERP_KERNEL::Exception(msg);
2243 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2248 for(int j=0;j<sz;j++)
2249 pt[slic.first+j*slic.second.second]=singleValV;
2254 if(sz!=(int)multiValV.size())
2256 std::ostringstream oss;
2257 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2258 throw INTERP_KERNEL::Exception(oss.str().c_str());
2260 for(int j=0;j<sz;j++)
2261 pt[slic.first+j*slic.second.second]=multiValV[j];
2266 const double *ptV=daIntTyyppV->getConstPointer();
2267 if(sz>daIntTyyppV->getNumberOfCompo())
2269 std::ostringstream oss;
2270 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2271 throw INTERP_KERNEL::Exception(oss.str().c_str());
2273 for(int j=0;j<sz;j++)
2274 pt[slic.first+j*slic.second.second]=ptV[j];
2278 throw INTERP_KERNEL::Exception(msg);
2282 throw INTERP_KERNEL::Exception(msg);
2288 class DataArrayIntIterator;
2290 class DataArrayInt : public DataArray
2293 static DataArrayInt *New();
2294 int intValue() const throw(INTERP_KERNEL::Exception);
2295 int getHashCode() const throw(INTERP_KERNEL::Exception);
2296 bool empty() const throw(INTERP_KERNEL::Exception);
2297 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2298 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2299 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2300 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2301 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2302 int popBackSilent() throw(INTERP_KERNEL::Exception);
2303 void pack() const throw(INTERP_KERNEL::Exception);
2304 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2305 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2306 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2307 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2308 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2309 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2310 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2311 void reverse() throw(INTERP_KERNEL::Exception);
2312 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2313 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2314 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2315 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2316 void fillWithZero() throw(INTERP_KERNEL::Exception);
2317 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2318 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2319 std::string repr() const throw(INTERP_KERNEL::Exception);
2320 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2321 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2322 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2323 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2324 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2325 MCAuto< MapII > invertArrayN2O2O2NOptimized() const throw(INTERP_KERNEL::Exception);
2326 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2327 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2328 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2329 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2330 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2331 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2332 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2333 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2334 int checkUniformAndGuess() const throw(INTERP_KERNEL::Exception);
2335 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2336 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2337 void transpose() throw(INTERP_KERNEL::Exception);
2338 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2339 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2340 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2341 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2342 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2343 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2344 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2345 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2346 int front() const throw(INTERP_KERNEL::Exception);
2347 int back() const throw(INTERP_KERNEL::Exception);
2348 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2349 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2350 int *getPointer() throw(INTERP_KERNEL::Exception);
2351 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2352 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2353 const int *begin() const throw(INTERP_KERNEL::Exception);
2354 const int *end() const throw(INTERP_KERNEL::Exception);
2355 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2356 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2357 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2358 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2359 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2360 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2361 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2362 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2363 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2364 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2365 int count(int value) const throw(INTERP_KERNEL::Exception);
2366 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2367 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2368 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2369 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2370 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2371 void abs() throw(INTERP_KERNEL::Exception);
2372 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2373 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2374 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2375 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2376 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2377 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2378 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2379 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2380 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2381 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2382 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2383 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2384 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2385 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2386 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2387 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2388 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2389 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2390 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2391 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2392 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2393 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2394 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2395 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2396 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2397 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2398 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2399 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2400 void computeOffsets() throw(INTERP_KERNEL::Exception);
2401 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2402 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2403 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2404 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2405 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2406 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2407 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2408 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2409 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2410 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2411 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2412 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2413 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2414 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2415 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2416 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2417 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2418 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2419 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2420 MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
2421 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2422 MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
2423 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2424 MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
2425 MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
2426 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
2427 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
2429 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2432 DataArrayInt() throw(INTERP_KERNEL::Exception)
2434 return DataArrayInt::New();
2437 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2439 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)";
2440 std::string msg(msgBase);
2442 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2445 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2449 if(PyInt_Check(nbOfTuples))
2451 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2453 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2456 if(PyInt_Check(nbOfComp))
2457 {//DataArrayInt.New([1,3,4,5],2,2)
2458 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2460 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2461 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2462 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2463 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2467 throw INTERP_KERNEL::Exception(msg.c_str());
2470 {//DataArrayInt.New([1,3,4],3)
2471 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2473 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2474 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2479 throw INTERP_KERNEL::Exception(msg.c_str());
2482 {// DataArrayInt.New([1,3,4])
2483 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2484 int tmpp1=-1,tmpp2=-1;
2485 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2486 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2490 else if(PyInt_Check(elt0))
2492 int nbOfTuples1=PyInt_AS_LONG(elt0);
2494 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2499 if(PyInt_Check(nbOfTuples))
2500 {//DataArrayInt.New(5,2)
2501 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2503 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2504 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2505 ret->alloc(nbOfTuples1,nbOfCompo);
2509 throw INTERP_KERNEL::Exception(msg.c_str());
2512 throw INTERP_KERNEL::Exception(msg.c_str());
2515 {//DataArrayInt.New(5)
2516 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2517 ret->alloc(nbOfTuples1,1);
2522 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2523 {//DataArrayInt.New(numpyArray)
2524 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2528 throw INTERP_KERNEL::Exception(msg.c_str());
2529 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2532 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2534 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2537 std::string __str__() const throw(INTERP_KERNEL::Exception)
2539 return self->reprNotTooLong();
2542 int __len__() const throw(INTERP_KERNEL::Exception)
2544 if(self->isAllocated())
2546 return self->getNumberOfTuples();
2550 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2554 int __int__() const throw(INTERP_KERNEL::Exception)
2556 return self->intValue();
2559 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2561 return self->iterator();
2564 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2566 int sz=self->getNumberOfComponents();
2567 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2568 self->accumulate(tmp);
2569 return convertIntArrToPyList(tmp,sz);
2572 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2575 std::vector<int> val2;
2576 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2577 return self->accumulatePerChunck(bg,bg+sz);
2580 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2583 std::vector<int> val2;
2584 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2585 return self->findIdsEqualTuple(bg,bg+sz);
2588 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2590 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2591 PyObject *ret=PyList_New(slcs.size());
2592 for(std::size_t i=0;i<slcs.size();i++)
2593 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2597 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2599 if(!PySlice_Check(slic))
2600 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2601 Py_ssize_t strt=2,stp=2,step=2;
2602 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2603 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2604 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2605 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 !");
2606 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2609 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2612 self->getMinMaxValues(a,b);
2613 PyObject *ret=PyTuple_New(2);
2614 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2615 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2619 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2621 int newNbOfTuples=-1;
2622 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2623 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2624 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2625 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2626 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2627 PyObject *ret=PyTuple_New(2);
2628 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2629 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2633 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2635 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2636 int szArr,sw,iTypppArr;
2637 std::vector<int> stdvecTyyppArr;
2638 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2639 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2640 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2644 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2646 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 !";
2647 if(PyList_Check(li) || PyTuple_Check(li))
2649 if(nbOfTuples && nbOfTuples != Py_None)
2651 if(PyInt_Check(nbOfTuples))
2653 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2655 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2656 if(nbOfComp && nbOfComp != Py_None)
2658 if(PyInt_Check(nbOfComp))
2659 {//DataArrayInt.setValues([1,3,4,5],2,2)
2660 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2662 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2663 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2664 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2667 throw INTERP_KERNEL::Exception(msg);
2670 {//DataArrayInt.setValues([1,3,4],3)
2672 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2673 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2677 throw INTERP_KERNEL::Exception(msg);
2680 {// DataArrayInt.setValues([1,3,4])
2681 int tmpp1=-1,tmpp2=-1;
2682 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2683 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2687 throw INTERP_KERNEL::Exception(msg);
2690 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2692 const int *vals=self->getConstPointer();
2693 return convertIntArrToPyList(vals,self->getNbOfElems());
2697 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2699 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2703 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2706 bool ret0=self->isEqualIfNotWhy(other,ret1);
2707 PyObject *ret=PyTuple_New(2);
2708 PyObject *ret0Py=ret0?Py_True:Py_False;
2710 PyTuple_SetItem(ret,0,ret0Py);
2711 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2715 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2717 const int *vals=self->getConstPointer();
2718 int nbOfComp=self->getNumberOfComponents();
2719 int nbOfTuples=self->getNumberOfTuples();
2720 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2723 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2725 std::vector<const DataArrayInt *> groups;
2726 std::vector< std::vector<int> > fidsOfGroups;
2727 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2728 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2729 PyObject *ret = PyList_New(2);
2730 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2731 int sz=fidsOfGroups.size();
2732 PyObject *ret1 = PyList_New(sz);
2733 for(int i=0;i<sz;i++)
2734 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2735 PyList_SetItem(ret,1,ret1);
2739 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2742 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
2743 if (!SWIG_IsOK(res1))
2745 int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
2748 MapII *m=reinterpret_cast<MapII *>(da);
2749 self->transformWithIndArr(*m);
2754 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2755 self->transformWithIndArr(tmp,tmp+size);
2760 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2761 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2765 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2769 std::vector<int> multiVal;
2770 std::pair<int, std::pair<int,int> > slic;
2771 MEDCoupling::DataArrayInt *daIntTyypp=0;
2772 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2776 return self->findIdsEqualList(&singleVal,&singleVal+1);
2778 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2780 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2782 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2786 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2790 std::vector<int> multiVal;
2791 std::pair<int, std::pair<int,int> > slic;
2792 MEDCoupling::DataArrayInt *daIntTyypp=0;
2793 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2797 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2799 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2801 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2803 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2807 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2809 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2811 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2812 if (!SWIG_IsOK(res1))
2815 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2816 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2820 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2822 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2823 da2->checkAllocated();
2824 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2826 PyObject *ret = PyList_New(3);
2827 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2828 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2829 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2833 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2836 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2837 if (!SWIG_IsOK(res1))
2840 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2841 return self->transformWithIndArrR(tmp,tmp+size);
2845 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2846 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2850 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2853 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2854 if (!SWIG_IsOK(res1))
2857 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2858 if(size!=self->getNumberOfTuples())
2860 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2862 return self->renumberAndReduce(tmp,newNbOfTuple);
2866 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2868 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2869 da2->checkAllocated();
2870 int size=self->getNumberOfTuples();
2871 if(size!=self->getNumberOfTuples())
2873 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2875 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2879 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2882 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2883 if (!SWIG_IsOK(res1))
2886 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2887 if(size!=self->getNumberOfTuples())
2889 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2891 return self->renumber(tmp);
2895 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2897 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2898 da2->checkAllocated();
2899 int size=self->getNumberOfTuples();
2900 if(size!=self->getNumberOfTuples())
2902 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2904 return self->renumber(da2->getConstPointer());
2908 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2911 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2912 if (!SWIG_IsOK(res1))
2915 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2916 if(size!=self->getNumberOfTuples())
2918 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2920 return self->renumberR(tmp);
2924 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2926 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2927 da2->checkAllocated();
2928 int size=self->getNumberOfTuples();
2929 if(size!=self->getNumberOfTuples())
2931 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2933 return self->renumberR(da2->getConstPointer());
2937 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2939 std::vector<int> tmp;
2940 convertPyToNewIntArr3(li,tmp);
2941 self->setSelectedComponents(a,tmp);
2944 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2946 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2947 std::size_t sz(retCpp.size());
2948 PyObject *res(PyList_New(sz));
2949 for(std::size_t i=0;i<sz;i++)
2950 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2954 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2956 int sz=self->getNumberOfComponents();
2957 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2958 self->getTuple(tupleId,tmp);
2959 return convertIntArrToPyList(tmp,sz);
2962 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2964 DataArrayInt *arr=0;
2965 DataArrayInt *arrI=0;
2966 self->changeSurjectiveFormat(targetNb,arr,arrI);
2967 PyObject *res = PyList_New(2);
2968 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2969 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2973 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2975 std::vector<const DataArrayInt *> tmp;
2976 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2977 return DataArrayInt::Meld(tmp);
2980 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2982 std::vector<const DataArrayInt *> tmp;
2983 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2984 return DataArrayInt::Aggregate(tmp);
2987 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2989 std::vector<const DataArrayInt *> tmp;
2990 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2991 return DataArrayInt::AggregateIndexes(tmp);
2994 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2996 std::vector<const DataArrayInt *> tmp;
2997 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2998 return DataArrayInt::BuildUnion(tmp);
3001 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3003 std::vector<const DataArrayInt *> tmp;
3004 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3005 return DataArrayInt::BuildIntersection(tmp);
3008 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3011 int r1=self->getMaxValue(tmp);
3012 PyObject *ret=PyTuple_New(2);
3013 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3014 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3018 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3021 int r1=self->getMinValue(tmp);
3022 PyObject *ret=PyTuple_New(2);
3023 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3024 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3028 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3030 int nbOfCompo=self->getNumberOfComponents();
3035 if(PyInt_Check(obj))
3037 int val=(int)PyInt_AS_LONG(obj);
3038 return self->findIdFirstEqual(val);
3041 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3045 std::vector<int> arr;
3046 convertPyToNewIntArr3(obj,arr);
3047 return self->findIdFirstEqualTuple(arr);
3052 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3054 int nbOfCompo=self->getNumberOfComponents();
3061 if(PyInt_Check(obj))
3063 int val=(int)PyInt_AS_LONG(obj);
3064 return self->presenceOfValue(val);
3067 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3071 std::vector<int> arr;
3072 convertPyToNewIntArr3(obj,arr);
3073 return self->presenceOfTuple(arr);
3078 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3080 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3081 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3082 self->checkAllocated();
3083 int nbOfTuples=self->getNumberOfTuples();
3084 int nbOfComponents=self->getNumberOfComponents();
3086 std::vector<int> vt1,vc1;
3087 std::pair<int, std::pair<int,int> > pt1,pc1;
3088 DataArrayInt *dt1=0,*dc1=0;
3090 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3091 MCAuto<DataArrayInt> ret;
3096 if(nbOfComponents==1)
3097 return PyInt_FromLong(self->getIJSafe(it1,0));
3098 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3101 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3103 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3105 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3107 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3110 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3111 std::vector<int> v2(1,ic1);
3112 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3116 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3117 std::vector<int> v2(1,ic1);
3118 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3122 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3123 std::vector<int> v2(1,ic1);
3124 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3128 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3129 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3133 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3134 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3138 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3139 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3143 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3144 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3148 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3149 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3150 std::vector<int> v2(nbOfComp);
3151 for(int i=0;i<nbOfComp;i++)
3152 v2[i]=pc1.first+i*pc1.second.second;
3153 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3157 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
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->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
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 );
3175 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3176 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3177 std::vector<int> v2(nbOfComp);
3178 for(int i=0;i<nbOfComp;i++)
3179 v2[i]=pc1.first+i*pc1.second.second;
3180 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3183 throw INTERP_KERNEL::Exception(msg);
3187 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3189 self->checkAllocated();
3190 const char msg[]="Unexpected situation in __setitem__ !";
3191 int nbOfTuples=self->getNumberOfTuples();
3192 int nbOfComponents=self->getNumberOfComponents();
3195 std::vector<int> v1;
3197 DataArrayIntTuple *dd1=0;
3198 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3200 std::vector<int> vt1,vc1;
3201 std::pair<int, std::pair<int,int> > pt1,pc1;
3202 DataArrayInt *dt1=0,*dc1=0;
3203 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3204 MCAuto<DataArrayInt> tmp;
3212 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3215 tmp=DataArrayInt::New();
3216 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3217 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3220 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3223 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3224 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3227 throw INTERP_KERNEL::Exception(msg);
3236 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3239 tmp=DataArrayInt::New();
3240 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3241 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3244 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3247 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3248 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3251 throw INTERP_KERNEL::Exception(msg);
3260 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3263 tmp=DataArrayInt::New();
3264 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3265 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3268 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3271 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3272 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3275 throw INTERP_KERNEL::Exception(msg);
3284 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3287 tmp=DataArrayInt::New();
3288 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3289 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3292 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3295 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3296 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3299 throw INTERP_KERNEL::Exception(msg);
3308 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3311 tmp=DataArrayInt::New();
3312 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3313 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3316 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3319 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3320 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3323 throw INTERP_KERNEL::Exception(msg);
3332 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3335 tmp=DataArrayInt::New();
3336 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3337 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3340 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3343 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3344 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3347 throw INTERP_KERNEL::Exception(msg);
3356 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3359 tmp=DataArrayInt::New();
3360 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3361 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3364 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3367 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3368 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3371 throw INTERP_KERNEL::Exception(msg);
3380 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3383 tmp=DataArrayInt::New();
3384 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3385 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3388 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3391 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3392 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3395 throw INTERP_KERNEL::Exception(msg);
3404 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3407 tmp=DataArrayInt::New();
3408 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3409 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3412 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3415 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3416 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3419 throw INTERP_KERNEL::Exception(msg);
3428 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3431 tmp=DataArrayInt::New();
3432 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3433 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3436 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3439 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3440 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3443 throw INTERP_KERNEL::Exception(msg);
3452 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3455 tmp=DataArrayInt::New();
3456 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3457 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3460 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3463 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3464 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3467 throw INTERP_KERNEL::Exception(msg);
3476 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3479 tmp=DataArrayInt::New();
3480 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3481 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3484 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3487 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3488 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3491 throw INTERP_KERNEL::Exception(msg);
3500 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3503 tmp=DataArrayInt::New();
3504 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3505 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3508 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3511 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3512 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3515 throw INTERP_KERNEL::Exception(msg);
3524 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3527 tmp=DataArrayInt::New();
3528 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3529 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3532 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3535 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3536 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3539 throw INTERP_KERNEL::Exception(msg);
3548 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3551 tmp=DataArrayInt::New();
3552 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3553 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3556 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3559 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3560 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3563 throw INTERP_KERNEL::Exception(msg);
3572 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3575 tmp=DataArrayInt::New();
3576 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3577 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3580 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3583 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3584 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3587 throw INTERP_KERNEL::Exception(msg);
3592 throw INTERP_KERNEL::Exception(msg);
3597 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3599 return self->negate();
3602 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3604 const char msg[]="Unexpected situation in __add__ !";
3607 std::vector<int> aa;
3608 DataArrayIntTuple *aaa;
3610 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3615 MCAuto<DataArrayInt> ret=self->deepCopy();
3616 ret->applyLin(1,val);
3621 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3622 return DataArrayInt::Add(self,aaaa);
3626 return DataArrayInt::Add(self,a);
3630 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3631 return DataArrayInt::Add(self,aaaa);
3634 throw INTERP_KERNEL::Exception(msg);
3638 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3640 const char msg[]="Unexpected situation in __radd__ !";
3643 std::vector<int> aa;
3644 DataArrayIntTuple *aaa;
3646 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3651 MCAuto<DataArrayInt> ret=self->deepCopy();
3652 ret->applyLin(1,val);
3657 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3658 return DataArrayInt::Add(self,aaaa);
3662 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3663 return DataArrayInt::Add(self,aaaa);
3666 throw INTERP_KERNEL::Exception(msg);
3670 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3672 const char msg[]="Unexpected situation in __iadd__ !";
3675 std::vector<int> aa;
3676 DataArrayIntTuple *aaa;
3678 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3683 self->applyLin(1,val);
3684 Py_XINCREF(trueSelf);
3689 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3691 Py_XINCREF(trueSelf);
3697 Py_XINCREF(trueSelf);
3702 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3703 self->addEqual(aaaa);
3704 Py_XINCREF(trueSelf);
3708 throw INTERP_KERNEL::Exception(msg);
3712 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3714 const char msg[]="Unexpected situation in __sub__ !";
3717 std::vector<int> aa;
3718 DataArrayIntTuple *aaa;
3720 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3725 MCAuto<DataArrayInt> ret=self->deepCopy();
3726 ret->applyLin(1,-val);
3731 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3732 return DataArrayInt::Substract(self,aaaa);
3736 return DataArrayInt::Substract(self,a);
3740 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3741 return DataArrayInt::Substract(self,aaaa);
3744 throw INTERP_KERNEL::Exception(msg);
3748 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3750 const char msg[]="Unexpected situation in __rsub__ !";
3753 std::vector<int> aa;
3754 DataArrayIntTuple *aaa;
3756 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3761 MCAuto<DataArrayInt> ret=self->deepCopy();
3762 ret->applyLin(-1,val);
3767 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3768 return DataArrayInt::Substract(aaaa,self);
3772 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3773 return DataArrayInt::Substract(aaaa,self);
3776 throw INTERP_KERNEL::Exception(msg);
3780 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3782 const char msg[]="Unexpected situation in __isub__ !";
3785 std::vector<int> aa;
3786 DataArrayIntTuple *aaa;
3788 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3793 self->applyLin(1,-val);
3794 Py_XINCREF(trueSelf);
3799 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3800 self->substractEqual(bb);
3801 Py_XINCREF(trueSelf);
3806 self->substractEqual(a);
3807 Py_XINCREF(trueSelf);
3812 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3813 self->substractEqual(aaaa);
3814 Py_XINCREF(trueSelf);
3818 throw INTERP_KERNEL::Exception(msg);
3822 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3824 const char msg[]="Unexpected situation in __mul__ !";
3827 std::vector<int> aa;
3828 DataArrayIntTuple *aaa;
3830 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3835 MCAuto<DataArrayInt> ret=self->deepCopy();
3836 ret->applyLin(val,0);
3841 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3842 return DataArrayInt::Multiply(self,aaaa);
3846 return DataArrayInt::Multiply(self,a);
3850 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3851 return DataArrayInt::Multiply(self,aaaa);
3854 throw INTERP_KERNEL::Exception(msg);
3858 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3860 const char msg[]="Unexpected situation in __rmul__ !";
3863 std::vector<int> aa;
3864 DataArrayIntTuple *aaa;
3866 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3871 MCAuto<DataArrayInt> ret=self->deepCopy();
3872 ret->applyLin(val,0);
3877 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3878 return DataArrayInt::Multiply(self,aaaa);
3882 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3883 return DataArrayInt::Multiply(self,aaaa);
3886 throw INTERP_KERNEL::Exception(msg);
3890 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3892 const char msg[]="Unexpected situation in __imul__ !";
3895 std::vector<int> aa;
3896 DataArrayIntTuple *aaa;
3898 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3903 self->applyLin(val,0);
3904 Py_XINCREF(trueSelf);
3909 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3910 self->multiplyEqual(bb);
3911 Py_XINCREF(trueSelf);
3916 self->multiplyEqual(a);
3917 Py_XINCREF(trueSelf);
3922 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3923 self->multiplyEqual(aaaa);
3924 Py_XINCREF(trueSelf);
3928 throw INTERP_KERNEL::Exception(msg);
3932 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3934 const char msg[]="Unexpected situation in __div__ !";
3937 std::vector<int> aa;
3938 DataArrayIntTuple *aaa;
3940 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3945 MCAuto<DataArrayInt> ret=self->deepCopy();
3946 ret->applyDivideBy(val);
3951 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3952 return DataArrayInt::Divide(self,aaaa);
3956 return DataArrayInt::Divide(self,a);
3960 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3961 return DataArrayInt::Divide(self,aaaa);
3964 throw INTERP_KERNEL::Exception(msg);
3968 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3970 const char msg[]="Unexpected situation in __rdiv__ !";
3973 std::vector<int> aa;
3974 DataArrayIntTuple *aaa;
3976 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3981 MCAuto<DataArrayInt> ret=self->deepCopy();
3987 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3988 return DataArrayInt::Divide(aaaa,self);
3992 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3993 return DataArrayInt::Divide(aaaa,self);
3996 throw INTERP_KERNEL::Exception(msg);
4000 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4002 const char msg[]="Unexpected situation in __idiv__ !";
4005 std::vector<int> aa;
4006 DataArrayIntTuple *aaa;
4008 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4013 self->applyDivideBy(val);
4014 Py_XINCREF(trueSelf);
4019 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4020 self->divideEqual(bb);
4021 Py_XINCREF(trueSelf);
4026 self->divideEqual(a);
4027 Py_XINCREF(trueSelf);
4032 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4033 self->divideEqual(aaaa);
4034 Py_XINCREF(trueSelf);
4038 throw INTERP_KERNEL::Exception(msg);
4042 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4044 const char msg[]="Unexpected situation in __mod__ !";
4047 std::vector<int> aa;
4048 DataArrayIntTuple *aaa;
4050 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4055 MCAuto<DataArrayInt> ret=self->deepCopy();
4056 ret->applyModulus(val);
4061 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4062 return DataArrayInt::Modulus(self,aaaa);
4066 return DataArrayInt::Modulus(self,a);
4070 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4071 return DataArrayInt::Modulus(self,aaaa);
4074 throw INTERP_KERNEL::Exception(msg);
4078 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4080 const char msg[]="Unexpected situation in __rmod__ !";
4083 std::vector<int> aa;
4084 DataArrayIntTuple *aaa;
4086 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4091 MCAuto<DataArrayInt> ret=self->deepCopy();
4092 ret->applyRModulus(val);
4097 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4098 return DataArrayInt::Modulus(aaaa,self);
4102 return DataArrayInt::Modulus(a,self);
4106 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4107 return DataArrayInt::Modulus(aaaa,self);
4110 throw INTERP_KERNEL::Exception(msg);
4114 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4116 const char msg[]="Unexpected situation in __imod__ !";
4119 std::vector<int> aa;
4120 DataArrayIntTuple *aaa;
4122 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4127 self->applyModulus(val);
4128 Py_XINCREF(trueSelf);
4133 self->modulusEqual(a);
4134 Py_XINCREF(trueSelf);
4139 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4140 self->modulusEqual(aaaa);
4141 Py_XINCREF(trueSelf);
4145 throw INTERP_KERNEL::Exception(msg);
4149 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4151 const char msg[]="Unexpected situation in __pow__ !";
4154 std::vector<int> aa;
4155 DataArrayIntTuple *aaa;
4157 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4162 MCAuto<DataArrayInt> ret=self->deepCopy();
4168 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4169 return DataArrayInt::Pow(self,aaaa);
4173 return DataArrayInt::Pow(self,a);
4177 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4178 return DataArrayInt::Pow(self,aaaa);
4181 throw INTERP_KERNEL::Exception(msg);
4185 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4187 const char msg[]="Unexpected situation in __rpow__ !";
4190 std::vector<int> aa;
4191 DataArrayIntTuple *aaa;
4193 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4198 MCAuto<DataArrayInt> ret=self->deepCopy();
4199 ret->applyRPow(val);
4204 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4205 return DataArrayInt::Pow(aaaa,self);
4209 return DataArrayInt::Pow(a,self);
4213 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4214 return DataArrayInt::Pow(aaaa,self);
4217 throw INTERP_KERNEL::Exception(msg);
4221 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4223 const char msg[]="Unexpected situation in __ipow__ !";
4226 std::vector<int> aa;
4227 DataArrayIntTuple *aaa;
4229 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4234 self->applyPow(val);
4235 Py_XINCREF(trueSelf);
4241 Py_XINCREF(trueSelf);
4246 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4247 self->powEqual(aaaa);
4248 Py_XINCREF(trueSelf);
4252 throw INTERP_KERNEL::Exception(msg);
4256 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4258 std::ostringstream oss;
4259 self->reprQuickOverview(oss);
4263 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4265 int szArr,sw,iTypppArr;
4266 std::vector<int> stdvecTyyppArr;
4267 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4268 self->pushBackValsSilent(tmp,tmp+szArr);
4271 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4273 std::vector<int> ret1;
4274 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4275 std::size_t sz=ret0.size();
4276 PyObject *pyRet=PyTuple_New(2);
4277 PyObject *pyRet0=PyList_New((int)sz);
4278 PyObject *pyRet1=PyList_New((int)sz);
4279 for(std::size_t i=0;i<sz;i++)
4281 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4282 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4284 PyTuple_SetItem(pyRet,0,pyRet0);
4285 PyTuple_SetItem(pyRet,1,pyRet1);
4289 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4291 DataArrayInt *ret0=0,*ret1=0;
4292 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4293 PyObject *pyRet=PyTuple_New(2);
4294 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4295 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4299 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4302 bool ret(self->isRange(a,b,c));
4303 PyObject *pyRet=PyTuple_New(2);
4304 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4306 PyTuple_SetItem(pyRet,0,ret0Py);
4308 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4314 PyTuple_SetItem(pyRet,1,ret1Py);
4319 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4321 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4324 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4327 if(!self->isAllocated())
4328 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4329 PyObject *ret(PyTuple_New(1));
4330 PyObject *ret0(PyDict_New());
4331 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4332 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4333 PyObject *tmp1(PyInt_FromLong(0));
4334 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4335 PyTuple_SetItem(ret,0,ret0);
4339 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4345 class DataArrayIntTuple;
4347 class DataArrayIntIterator
4350 DataArrayIntIterator(DataArrayInt *da);
4351 ~DataArrayIntIterator();
4356 DataArrayIntTuple *ret=self->nextt();
4358 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4361 PyErr_SetString(PyExc_StopIteration,"No more data.");
4368 class DataArrayIntTuple
4371 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4372 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4375 std::string __str__() const throw(INTERP_KERNEL::Exception)
4377 return self->repr();
4380 int __int__() const throw(INTERP_KERNEL::Exception)
4382 return self->intValue();
4385 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4387 return self->buildDAInt(1,self->getNumberOfCompo());
4390 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4392 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4393 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4394 Py_XINCREF(trueSelf);
4398 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4400 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4401 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4402 Py_XINCREF(trueSelf);
4406 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4408 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4409 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4410 Py_XINCREF(trueSelf);
4414 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4416 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4417 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4418 Py_XINCREF(trueSelf);
4422 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4424 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4425 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4426 Py_XINCREF(trueSelf);
4430 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4432 return PyInt_FromLong(self->getNumberOfCompo());
4435 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4437 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4440 std::vector<int> multiVal;
4441 std::pair<int, std::pair<int,int> > slic;
4442 MEDCoupling::DataArrayInt *daIntTyypp=0;
4443 const int *pt=self->getConstPointer();
4444 int nbc=self->getNumberOfCompo();
4445 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4452 std::ostringstream oss;
4453 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4454 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4458 return PyInt_FromLong(pt[singleVal]);
4462 return PyInt_FromLong(pt[nbc+singleVal]);
4465 std::ostringstream oss;
4466 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4467 throw INTERP_KERNEL::Exception(oss.str().c_str());
4473 PyObject *t=PyTuple_New(multiVal.size());
4474 for(int j=0;j<(int)multiVal.size();j++)
4476 int cid=multiVal[j];
4479 std::ostringstream oss;
4480 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4481 throw INTERP_KERNEL::Exception(oss.str().c_str());
4483 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4489 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4490 PyObject *t=PyTuple_New(sz);
4491 for(int j=0;j<sz;j++)
4492 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4496 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4500 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4502 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4503 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4506 std::vector<int> multiValV;
4507 std::pair<int, std::pair<int,int> > slicV;
4508 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4509 int nbc=self->getNumberOfCompo();
4510 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4512 std::vector<int> multiVal;
4513 std::pair<int, std::pair<int,int> > slic;
4514 MEDCoupling::DataArrayInt *daIntTyypp=0;
4515 int *pt=self->getPointer();
4516 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4523 std::ostringstream oss;
4524 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4525 throw INTERP_KERNEL::Exception(oss.str().c_str());
4531 pt[singleVal]=singleValV;
4536 if(multiValV.size()!=1)
4538 std::ostringstream oss;
4539 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4540 throw INTERP_KERNEL::Exception(oss.str().c_str());
4542 pt[singleVal]=multiValV[0];
4547 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4551 throw INTERP_KERNEL::Exception(msg);
4560 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4564 std::ostringstream oss;
4565 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4566 throw INTERP_KERNEL::Exception(oss.str().c_str());
4574 if(multiVal.size()!=multiValV.size())
4576 std::ostringstream oss;
4577 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4578 throw INTERP_KERNEL::Exception(oss.str().c_str());
4580 for(int i=0;i<(int)multiVal.size();i++)
4582 int pos=multiVal[i];
4585 std::ostringstream oss;
4586 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4587 throw INTERP_KERNEL::Exception(oss.str().c_str());
4589 pt[multiVal[i]]=multiValV[i];
4595 const int *ptV=daIntTyyppV->getConstPointer();
4596 if(nbc>daIntTyyppV->getNumberOfCompo())
4598 std::ostringstream oss;
4599 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4600 throw INTERP_KERNEL::Exception(oss.str().c_str());
4602 std::copy(ptV,ptV+nbc,pt);
4606 throw INTERP_KERNEL::Exception(msg);
4611 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4616 for(int j=0;j<sz;j++)
4617 pt[slic.first+j*slic.second.second]=singleValV;
4622 if(sz!=(int)multiValV.size())
4624 std::ostringstream oss;
4625 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4626 throw INTERP_KERNEL::Exception(oss.str().c_str());
4628 for(int j=0;j<sz;j++)
4629 pt[slic.first+j*slic.second.second]=multiValV[j];
4634 const int *ptV=daIntTyyppV->getConstPointer();
4635 if(sz>daIntTyyppV->getNumberOfCompo())
4637 std::ostringstream oss;
4638 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4639 throw INTERP_KERNEL::Exception(oss.str().c_str());
4641 for(int j=0;j<sz;j++)
4642 pt[slic.first+j*slic.second.second]=ptV[j];
4646 throw INTERP_KERNEL::Exception(msg);
4650 throw INTERP_KERNEL::Exception(msg);
4656 class DataArrayChar : public DataArray
4659 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4660 int getHashCode() const throw(INTERP_KERNEL::Exception);
4661 bool empty() const throw(INTERP_KERNEL::Exception);
4662 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4663 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4664 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4665 char popBackSilent() throw(INTERP_KERNEL::Exception);
4666 void pack() const throw(INTERP_KERNEL::Exception);
4667 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4668 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4669 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4670 void reverse() throw(INTERP_KERNEL::Exception);
4671 void fillWithZero() throw(INTERP_KERNEL::Exception);
4672 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4673 std::string repr() const throw(INTERP_KERNEL::Exception);
4674 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4675 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4676 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4677 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4678 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4679 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4680 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4681 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4682 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4683 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4684 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4685 char front() const throw(INTERP_KERNEL::Exception);
4686 char back() const throw(INTERP_KERNEL::Exception);
4687 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4688 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4689 char *getPointer() throw(INTERP_KERNEL::Exception);
4690 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4691 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4692 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4693 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4694 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4695 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4696 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4697 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4698 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4699 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4700 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4703 int __len__() const throw(INTERP_KERNEL::Exception)
4705 if(self->isAllocated())
4707 return self->getNumberOfTuples();
4711 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4715 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4718 bool ret0=self->isEqualIfNotWhy(other,ret1);
4719 PyObject *ret=PyTuple_New(2);
4720 PyObject *ret0Py=ret0?Py_True:Py_False;
4722 PyTuple_SetItem(ret,0,ret0Py);
4723 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4727 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4730 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4731 if (!SWIG_IsOK(res1))
4734 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4735 if(size!=self->getNumberOfTuples())
4737 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4739 return self->renumber(tmp);
4743 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4745 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4746 da2->checkAllocated();
4747 int size=self->getNumberOfTuples();
4748 if(size!=self->getNumberOfTuples())
4750 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4752 return self->renumber(da2->getConstPointer());
4756 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4759 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4760 if (!SWIG_IsOK(res1))
4763 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4764 if(size!=self->getNumberOfTuples())
4766 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4768 return self->renumberR(tmp);
4772 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4774 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4775 da2->checkAllocated();
4776 int size=self->getNumberOfTuples();
4777 if(size!=self->getNumberOfTuples())
4779 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4781 return self->renumberR(da2->getConstPointer());
4785 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4788 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4789 if (!SWIG_IsOK(res1))
4792 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4793 if(size!=self->getNumberOfTuples())
4795 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4797 return self->renumberAndReduce(tmp,newNbOfTuple);
4801 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4803 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4804 da2->checkAllocated();
4805 int size=self->getNumberOfTuples();
4806 if(size!=self->getNumberOfTuples())
4808 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4810 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4814 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4816 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4817 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4818 return DataArrayChar::Aggregate(tmp);
4821 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4823 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4824 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4825 return DataArrayChar::Meld(tmp);
4830 class DataArrayByteIterator;
4832 class DataArrayByte : public DataArrayChar
4835 static DataArrayByte *New();
4836 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4837 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4838 char byteValue() const throw(INTERP_KERNEL::Exception);
4841 DataArrayByte() throw(INTERP_KERNEL::Exception)
4843 return DataArrayByte::New();
4846 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4848 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) !";
4849 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4853 if(PyInt_Check(nbOfTuples))
4855 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4857 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4860 if(PyInt_Check(nbOfComp))
4861 {//DataArrayByte.New([1,3,4,5],2,2)
4862 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4864 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4865 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4866 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4867 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4871 throw INTERP_KERNEL::Exception(msg);
4874 {//DataArrayByte.New([1,3,4],3)
4875 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4877 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4878 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4883 throw INTERP_KERNEL::Exception(msg);
4886 {// DataArrayByte.New([1,3,4])
4887 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4888 int tmpp1=-1,tmpp2=-1;
4889 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4890 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4894 else if(PyInt_Check(elt0))
4896 int nbOfTuples1=PyInt_AS_LONG(elt0);
4898 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4903 if(PyInt_Check(nbOfTuples))
4904 {//DataArrayByte.New(5,2)
4905 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4907 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4908 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4909 ret->alloc(nbOfTuples1,nbOfCompo);
4913 throw INTERP_KERNEL::Exception(msg);
4916 throw INTERP_KERNEL::Exception(msg);
4919 {//DataArrayByte.New(5)
4920 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4921 ret->alloc(nbOfTuples1,1);
4926 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4927 {//DataArrayDouble.New(numpyArray)
4928 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4932 throw INTERP_KERNEL::Exception(msg);
4935 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4937 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4940 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4942 std::ostringstream oss;
4943 self->reprQuickOverview(oss);
4947 int __int__() const throw(INTERP_KERNEL::Exception)
4949 return (int) self->byteValue();
4952 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4954 return self->iterator();
4957 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4959 return (int)self->getIJ(tupleId,compoId);
4962 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4964 return (int)self->getIJSafe(tupleId,compoId);
4967 std::string __str__() const throw(INTERP_KERNEL::Exception)
4969 return self->repr();
4972 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4974 const char *vals=self->getConstPointer();
4975 int nbOfComp=self->getNumberOfComponents();
4976 int nbOfTuples=self->getNumberOfTuples();
4977 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4980 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4983 int ival=-1; std::vector<int> ivval;
4984 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4985 std::vector<char> vals(sz);
4986 std::copy(pt,pt+sz,vals.begin());
4987 return self->presenceOfTuple(vals);
4990 bool presenceOfValue(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->presenceOfValue(vals2);
5000 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5003 int ival=-1; std::vector<int> ivval;
5004 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
5005 std::vector<char> vals2(sz);
5006 std::copy(pt,pt+sz,vals2.begin());
5007 return self->findIdFirstEqual(vals2);
5010 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5013 int ival=-1; std::vector<int> ivval;
5014 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
5015 std::vector<char> vals(sz);
5016 std::copy(pt,pt+sz,vals.begin());
5017 return self->findIdFirstEqualTuple(vals);
5020 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5023 int ival=-1; std::vector<int> ivval;
5024 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
5025 std::vector<char> vals(sz);
5026 std::copy(pt,pt+sz,vals.begin());
5027 return self->findIdSequence(vals);
5030 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5032 int sz=self->getNumberOfComponents();
5033 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5034 self->getTuple(tupleId,tmp);
5035 PyObject *ret=PyTuple_New(sz);
5036 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5040 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5043 int r1=(int)self->getMaxValue(tmp);
5044 PyObject *ret=PyTuple_New(2);
5045 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5046 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5050 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5053 int r1=(int)self->getMinValue(tmp);
5054 PyObject *ret=PyTuple_New(2);
5055 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5056 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5060 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5062 int nbOfCompo=self->getNumberOfComponents();
5067 if(PyInt_Check(obj))
5069 int val=(int)PyInt_AS_LONG(obj);
5070 return self->findIdFirstEqual(val);
5073 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5076 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5080 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5082 int nbOfCompo=self->getNumberOfComponents();
5089 if(PyInt_Check(obj))
5091 int val=(int)PyInt_AS_LONG(obj);
5092 return self->presenceOfValue(val);
5095 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5098 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5103 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5105 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5110 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5112 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5115 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5118 if(!self->isAllocated())
5119 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5120 PyObject *ret(PyTuple_New(1));
5121 PyObject *ret0(PyDict_New());
5122 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5123 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5124 PyObject *tmp1(PyInt_FromLong(0));
5125 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5126 PyTuple_SetItem(ret,0,ret0);
5130 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5134 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5136 self->checkAllocated();
5137 const char msg[]="Unexpected situation in __setitem__ !";
5138 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5141 std::vector<int> v1;
5143 DataArrayIntTuple *dd1=0;
5144 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5146 std::vector<int> vt1,vc1;
5147 std::pair<int, std::pair<int,int> > pt1,pc1;
5148 DataArrayInt *dt1=0,*dc1=0;
5149 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5150 MCAuto<DataArrayInt> tmp;
5158 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5161 throw INTERP_KERNEL::Exception(msg);
5170 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5173 throw INTERP_KERNEL::Exception(msg);
5182 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5185 throw INTERP_KERNEL::Exception(msg);
5194 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5197 throw INTERP_KERNEL::Exception(msg);
5206 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5209 throw INTERP_KERNEL::Exception(msg);
5218 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5221 throw INTERP_KERNEL::Exception(msg);
5230 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5233 throw INTERP_KERNEL::Exception(msg);
5242 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5245 throw INTERP_KERNEL::Exception(msg);
5254 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5257 throw INTERP_KERNEL::Exception(msg);
5266 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5269 throw INTERP_KERNEL::Exception(msg);
5278 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5281 throw INTERP_KERNEL::Exception(msg);
5290 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5293 throw INTERP_KERNEL::Exception(msg);
5302 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5305 throw INTERP_KERNEL::Exception(msg);
5314 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5317 throw INTERP_KERNEL::Exception(msg);
5326 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5329 throw INTERP_KERNEL::Exception(msg);
5338 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5341 throw INTERP_KERNEL::Exception(msg);
5346 throw INTERP_KERNEL::Exception(msg);
5353 class DataArrayByteTuple;
5355 class DataArrayByteIterator
5358 DataArrayByteIterator(DataArrayByte *da);
5359 ~DataArrayByteIterator();
5362 class DataArrayByteTuple
5365 std::string repr() const throw(INTERP_KERNEL::Exception);
5366 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5369 std::string __str__() const throw(INTERP_KERNEL::Exception)
5371 return self->repr();
5374 char __int__() const throw(INTERP_KERNEL::Exception)
5376 return self->byteValue();
5379 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5381 return self->buildDAByte(1,self->getNumberOfCompo());
5386 class DataArrayAsciiCharIterator;
5388 class DataArrayAsciiChar : public DataArrayChar
5391 static DataArrayAsciiChar *New();
5392 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5393 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5394 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5397 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5399 return DataArrayAsciiChar::New();
5402 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5404 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) !";
5405 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5409 if(PyInt_Check(nbOfTuples))
5411 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5413 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5416 if(PyInt_Check(nbOfComp))
5417 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5418 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5420 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5421 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5422 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5423 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5427 throw INTERP_KERNEL::Exception(msg);
5430 {//DataArrayAsciiChar.New([1,3,4],3)
5431 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5433 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5434 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5438 else if(PyString_Check(nbOfTuples))
5440 if(PyString_Size(nbOfTuples)!=1)
5441 throw INTERP_KERNEL::Exception(msg);
5442 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5443 std::vector<std::string> tmp;
5444 if(fillStringVector(elt0,tmp))
5445 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5447 throw INTERP_KERNEL::Exception(msg);
5450 throw INTERP_KERNEL::Exception(msg);
5454 std::vector<std::string> tmmp;
5455 if(fillStringVector(elt0,tmmp))
5456 //DataArrayAsciiChar.New(["abc","de","fghi"])
5457 return DataArrayAsciiChar::New(tmmp,' ');
5460 // DataArrayAsciiChar.New([1,3,4])
5461 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5462 int tmpp1=-1,tmpp2=-1;
5463 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5464 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5469 else if(PyInt_Check(elt0))
5471 int nbOfTuples1=PyInt_AS_LONG(elt0);
5473 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5478 if(PyInt_Check(nbOfTuples))
5479 {//DataArrayAsciiChar.New(5,2)
5480 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5482 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5483 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5484 ret->alloc(nbOfTuples1,nbOfCompo);
5488 throw INTERP_KERNEL::Exception(msg);
5491 throw INTERP_KERNEL::Exception(msg);
5494 {//DataArrayAsciiChar.New(5)
5495 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5496 ret->alloc(nbOfTuples1,1);
5501 throw INTERP_KERNEL::Exception(msg);
5504 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5506 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5509 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5511 std::ostringstream oss;
5512 self->reprQuickOverview(oss);
5516 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5518 return self->iterator();
5521 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5523 char tmp[2]; tmp[1]='\0';
5524 tmp[0]=self->getIJ(tupleId,compoId);
5525 return std::string(tmp);
5528 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5530 char tmp[2]; tmp[1]='\0';
5531 tmp[0]=self->getIJSafe(tupleId,compoId);
5532 return std::string(tmp);
5535 std::string __str__() const throw(INTERP_KERNEL::Exception)
5537 return self->repr();
5540 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5542 const char *vals=self->getConstPointer();
5543 int nbOfComp=self->getNumberOfComponents();
5544 int nbOfTuples=self->getNumberOfTuples();
5545 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5548 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5550 if(PyString_Check(tupl))
5552 Py_ssize_t sz=PyString_Size(tupl);
5553 std::vector<char> vals(sz);
5554 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5555 return self->presenceOfTuple(vals);
5558 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5561 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5563 if(PyString_Check(vals))
5565 Py_ssize_t sz=PyString_Size(vals);
5566 std::vector<char> vals2(sz);
5567 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5568 return self->presenceOfValue(vals2);
5571 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5574 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5576 if(PyString_Check(vals))
5578 Py_ssize_t sz=PyString_Size(vals);
5579 std::vector<char> vals2(sz);
5580 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5581 return self->findIdFirstEqual(vals2);
5584 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5587 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5589 if(PyString_Check(tupl))
5591 Py_ssize_t sz=PyString_Size(tupl);
5592 std::vector<char> vals(sz);
5593 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5594 return self->findIdFirstEqualTuple(vals);
5597 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5600 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5602 if(PyString_Check(strOrListOfInt))
5604 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5605 std::vector<char> vals(sz);
5606 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5607 return self->findIdSequence(vals);
5610 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5613 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5615 int sz=self->getNumberOfComponents();
5616 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5617 self->getTuple(tupleId,tmp);
5618 return PyString_FromString(tmp);
5621 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5624 char tmp2[2]; tmp2[1]='\0';
5625 tmp2[0]=self->getMaxValue(tmp);
5626 PyObject *ret=PyTuple_New(2);
5627 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5628 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5632 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5635 char tmp2[2]; tmp2[1]='\0';
5636 tmp2[0]=self->getMinValue(tmp);
5637 PyObject *ret=PyTuple_New(2);
5638 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5639 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5643 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5645 int nbOfCompo=self->getNumberOfComponents();
5650 if(PyString_Check(obj))
5652 Py_ssize_t sz=PyString_Size(obj);
5653 char *pt=PyString_AsString(obj);
5655 return self->findIdFirstEqual(pt[0]);
5657 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5660 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5663 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5667 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5669 int nbOfCompo=self->getNumberOfComponents();
5676 if(PyString_Check(obj))
5678 Py_ssize_t sz=PyString_Size(obj);
5679 char *pt=PyString_AsString(obj);
5681 return self->presenceOfValue(pt[0]);
5683 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5686 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5689 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5693 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5696 std::vector<int> stdvecTyyppArr;
5697 std::pair<int, std::pair<int,int> > sTyyppArr;
5698 MEDCoupling::DataArrayInt *daIntTyypp=0;
5699 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5703 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5705 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5707 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5709 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5711 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5715 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5717 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.";
5719 std::vector<int> stdvecTyyppArr;
5720 std::pair<int, std::pair<int,int> > sTyyppArr;
5721 MEDCoupling::DataArrayInt *daIntTyypp=0;
5722 int nbOfCompo=self->getNumberOfComponents();
5723 int nbOfTuples=self->getNumberOfTuples();
5724 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5726 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5727 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5736 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5742 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5743 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5746 //value vector<string>
5749 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5750 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5753 //value DataArrayChar
5756 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5760 throw INTERP_KERNEL::Exception(msg);
5764 {//obj list-tuple[int]
5770 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5776 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5777 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5780 //value vector<string>
5783 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5784 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5787 //value DataArrayChar
5790 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5794 throw INTERP_KERNEL::Exception(msg);
5805 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5811 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5812 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5815 //value vector<string>
5818 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5819 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5822 //value DataArrayChar
5825 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5829 throw INTERP_KERNEL::Exception(msg);
5840 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5846 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5847 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5850 //value vector<string>
5853 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5854 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5857 //value DataArrayChar
5860 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5864 throw INTERP_KERNEL::Exception(msg);
5869 throw INTERP_KERNEL::Exception(msg);
5875 class DataArrayAsciiCharTuple;
5877 class DataArrayAsciiCharIterator
5880 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5881 ~DataArrayAsciiCharIterator();
5886 DataArrayAsciiCharTuple *ret=self->nextt();
5888 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5891 PyErr_SetString(PyExc_StopIteration,"No more data.");
5898 class DataArrayAsciiCharTuple
5901 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5902 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5905 std::string __str__() const throw(INTERP_KERNEL::Exception)
5907 return self->repr();
5910 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5912 return self->buildDAAsciiChar(1,self->getNumberOfCompo());