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 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2335 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2336 void transpose() throw(INTERP_KERNEL::Exception);
2337 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2338 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2339 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2340 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2341 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2342 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2343 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2344 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2345 int front() const throw(INTERP_KERNEL::Exception);
2346 int back() const throw(INTERP_KERNEL::Exception);
2347 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2348 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2349 int *getPointer() throw(INTERP_KERNEL::Exception);
2350 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2351 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2352 const int *begin() const throw(INTERP_KERNEL::Exception);
2353 const int *end() const throw(INTERP_KERNEL::Exception);
2354 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2355 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2356 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2357 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2358 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2359 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2360 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2361 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2362 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2363 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2364 int count(int value) const throw(INTERP_KERNEL::Exception);
2365 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2366 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2367 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2368 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2369 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2370 void abs() throw(INTERP_KERNEL::Exception);
2371 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2372 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2373 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2374 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2375 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2376 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2377 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2378 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2379 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2380 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2381 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2382 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2383 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2384 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2385 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2386 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2387 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2388 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2389 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2390 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2391 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2392 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2393 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2394 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2395 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2396 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2397 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2398 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2399 void computeOffsets() throw(INTERP_KERNEL::Exception);
2400 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2401 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2402 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2403 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2404 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2405 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2406 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2407 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2408 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2409 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2410 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2411 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2412 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2413 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2414 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2415 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2416 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2417 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2418 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2419 MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
2420 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2421 MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
2422 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2423 MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
2424 MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
2425 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
2426 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
2428 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2431 DataArrayInt() throw(INTERP_KERNEL::Exception)
2433 return DataArrayInt::New();
2436 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2438 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)";
2439 std::string msg(msgBase);
2441 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2444 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2448 if(PyInt_Check(nbOfTuples))
2450 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2452 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2455 if(PyInt_Check(nbOfComp))
2456 {//DataArrayInt.New([1,3,4,5],2,2)
2457 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2459 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2460 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2461 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2462 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2466 throw INTERP_KERNEL::Exception(msg.c_str());
2469 {//DataArrayInt.New([1,3,4],3)
2470 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2472 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2473 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2478 throw INTERP_KERNEL::Exception(msg.c_str());
2481 {// DataArrayInt.New([1,3,4])
2482 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2483 int tmpp1=-1,tmpp2=-1;
2484 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2485 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2489 else if(PyInt_Check(elt0))
2491 int nbOfTuples1=PyInt_AS_LONG(elt0);
2493 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2498 if(PyInt_Check(nbOfTuples))
2499 {//DataArrayInt.New(5,2)
2500 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2502 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2503 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2504 ret->alloc(nbOfTuples1,nbOfCompo);
2508 throw INTERP_KERNEL::Exception(msg.c_str());
2511 throw INTERP_KERNEL::Exception(msg.c_str());
2514 {//DataArrayInt.New(5)
2515 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2516 ret->alloc(nbOfTuples1,1);
2521 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2522 {//DataArrayInt.New(numpyArray)
2523 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2527 throw INTERP_KERNEL::Exception(msg.c_str());
2528 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2531 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2533 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2536 std::string __str__() const throw(INTERP_KERNEL::Exception)
2538 return self->reprNotTooLong();
2541 int __len__() const throw(INTERP_KERNEL::Exception)
2543 if(self->isAllocated())
2545 return self->getNumberOfTuples();
2549 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2553 int __int__() const throw(INTERP_KERNEL::Exception)
2555 return self->intValue();
2558 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2560 return self->iterator();
2563 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2565 int sz=self->getNumberOfComponents();
2566 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2567 self->accumulate(tmp);
2568 return convertIntArrToPyList(tmp,sz);
2571 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2574 std::vector<int> val2;
2575 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2576 return self->accumulatePerChunck(bg,bg+sz);
2579 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2582 std::vector<int> val2;
2583 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2584 return self->findIdsEqualTuple(bg,bg+sz);
2587 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2589 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2590 PyObject *ret=PyList_New(slcs.size());
2591 for(std::size_t i=0;i<slcs.size();i++)
2592 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2596 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2598 if(!PySlice_Check(slic))
2599 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2600 Py_ssize_t strt=2,stp=2,step=2;
2601 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2602 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2603 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2604 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 !");
2605 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2608 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2611 self->getMinMaxValues(a,b);
2612 PyObject *ret=PyTuple_New(2);
2613 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2614 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2618 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2620 int newNbOfTuples=-1;
2621 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2622 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2623 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2624 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2625 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2626 PyObject *ret=PyTuple_New(2);
2627 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2628 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2632 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2634 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2635 int szArr,sw,iTypppArr;
2636 std::vector<int> stdvecTyyppArr;
2637 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2638 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2639 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2643 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2645 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 !";
2646 if(PyList_Check(li) || PyTuple_Check(li))
2648 if(nbOfTuples && nbOfTuples != Py_None)
2650 if(PyInt_Check(nbOfTuples))
2652 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2654 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2655 if(nbOfComp && nbOfComp != Py_None)
2657 if(PyInt_Check(nbOfComp))
2658 {//DataArrayInt.setValues([1,3,4,5],2,2)
2659 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2661 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2662 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2663 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2666 throw INTERP_KERNEL::Exception(msg);
2669 {//DataArrayInt.setValues([1,3,4],3)
2671 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2672 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2676 throw INTERP_KERNEL::Exception(msg);
2679 {// DataArrayInt.setValues([1,3,4])
2680 int tmpp1=-1,tmpp2=-1;
2681 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2682 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2686 throw INTERP_KERNEL::Exception(msg);
2689 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2691 const int *vals=self->getConstPointer();
2692 return convertIntArrToPyList(vals,self->getNbOfElems());
2696 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2698 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2702 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2705 bool ret0=self->isEqualIfNotWhy(other,ret1);
2706 PyObject *ret=PyTuple_New(2);
2707 PyObject *ret0Py=ret0?Py_True:Py_False;
2709 PyTuple_SetItem(ret,0,ret0Py);
2710 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2714 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2716 const int *vals=self->getConstPointer();
2717 int nbOfComp=self->getNumberOfComponents();
2718 int nbOfTuples=self->getNumberOfTuples();
2719 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2722 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2724 std::vector<const DataArrayInt *> groups;
2725 std::vector< std::vector<int> > fidsOfGroups;
2726 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2727 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2728 PyObject *ret = PyList_New(2);
2729 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2730 int sz=fidsOfGroups.size();
2731 PyObject *ret1 = PyList_New(sz);
2732 for(int i=0;i<sz;i++)
2733 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2734 PyList_SetItem(ret,1,ret1);
2738 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2741 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
2742 if (!SWIG_IsOK(res1))
2744 int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
2747 MapII *m=reinterpret_cast<MapII *>(da);
2748 self->transformWithIndArr(*m);
2753 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2754 self->transformWithIndArr(tmp,tmp+size);
2759 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2760 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2764 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2768 std::vector<int> multiVal;
2769 std::pair<int, std::pair<int,int> > slic;
2770 MEDCoupling::DataArrayInt *daIntTyypp=0;
2771 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2775 return self->findIdsEqualList(&singleVal,&singleVal+1);
2777 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2779 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2781 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2785 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2789 std::vector<int> multiVal;
2790 std::pair<int, std::pair<int,int> > slic;
2791 MEDCoupling::DataArrayInt *daIntTyypp=0;
2792 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2796 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2798 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2800 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2802 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2806 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2808 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2810 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2811 if (!SWIG_IsOK(res1))
2814 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2815 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2819 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2821 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2822 da2->checkAllocated();
2823 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2825 PyObject *ret = PyList_New(3);
2826 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2827 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2828 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2832 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2835 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2836 if (!SWIG_IsOK(res1))
2839 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2840 return self->transformWithIndArrR(tmp,tmp+size);
2844 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2845 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2849 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2852 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2853 if (!SWIG_IsOK(res1))
2856 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2857 if(size!=self->getNumberOfTuples())
2859 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2861 return self->renumberAndReduce(tmp,newNbOfTuple);
2865 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2867 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2868 da2->checkAllocated();
2869 int size=self->getNumberOfTuples();
2870 if(size!=self->getNumberOfTuples())
2872 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2874 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2878 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2881 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2882 if (!SWIG_IsOK(res1))
2885 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2886 if(size!=self->getNumberOfTuples())
2888 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2890 return self->renumber(tmp);
2894 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2896 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2897 da2->checkAllocated();
2898 int size=self->getNumberOfTuples();
2899 if(size!=self->getNumberOfTuples())
2901 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2903 return self->renumber(da2->getConstPointer());
2907 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2910 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2911 if (!SWIG_IsOK(res1))
2914 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2915 if(size!=self->getNumberOfTuples())
2917 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2919 return self->renumberR(tmp);
2923 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2925 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2926 da2->checkAllocated();
2927 int size=self->getNumberOfTuples();
2928 if(size!=self->getNumberOfTuples())
2930 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2932 return self->renumberR(da2->getConstPointer());
2936 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2938 std::vector<int> tmp;
2939 convertPyToNewIntArr3(li,tmp);
2940 self->setSelectedComponents(a,tmp);
2943 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2945 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2946 std::size_t sz(retCpp.size());
2947 PyObject *res(PyList_New(sz));
2948 for(std::size_t i=0;i<sz;i++)
2949 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2953 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2955 int sz=self->getNumberOfComponents();
2956 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2957 self->getTuple(tupleId,tmp);
2958 return convertIntArrToPyList(tmp,sz);
2961 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2963 DataArrayInt *arr=0;
2964 DataArrayInt *arrI=0;
2965 self->changeSurjectiveFormat(targetNb,arr,arrI);
2966 PyObject *res = PyList_New(2);
2967 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2968 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2972 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2974 std::vector<const DataArrayInt *> tmp;
2975 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2976 return DataArrayInt::Meld(tmp);
2979 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2981 std::vector<const DataArrayInt *> tmp;
2982 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2983 return DataArrayInt::Aggregate(tmp);
2986 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2988 std::vector<const DataArrayInt *> tmp;
2989 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2990 return DataArrayInt::AggregateIndexes(tmp);
2993 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2995 std::vector<const DataArrayInt *> tmp;
2996 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2997 return DataArrayInt::BuildUnion(tmp);
3000 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3002 std::vector<const DataArrayInt *> tmp;
3003 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3004 return DataArrayInt::BuildIntersection(tmp);
3007 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3010 int r1=self->getMaxValue(tmp);
3011 PyObject *ret=PyTuple_New(2);
3012 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3013 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3017 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3020 int r1=self->getMinValue(tmp);
3021 PyObject *ret=PyTuple_New(2);
3022 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3023 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3027 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3029 int nbOfCompo=self->getNumberOfComponents();
3034 if(PyInt_Check(obj))
3036 int val=(int)PyInt_AS_LONG(obj);
3037 return self->findIdFirstEqual(val);
3040 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3044 std::vector<int> arr;
3045 convertPyToNewIntArr3(obj,arr);
3046 return self->findIdFirstEqualTuple(arr);
3051 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3053 int nbOfCompo=self->getNumberOfComponents();
3060 if(PyInt_Check(obj))
3062 int val=(int)PyInt_AS_LONG(obj);
3063 return self->presenceOfValue(val);
3066 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3070 std::vector<int> arr;
3071 convertPyToNewIntArr3(obj,arr);
3072 return self->presenceOfTuple(arr);
3077 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3079 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3080 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3081 self->checkAllocated();
3082 int nbOfTuples=self->getNumberOfTuples();
3083 int nbOfComponents=self->getNumberOfComponents();
3085 std::vector<int> vt1,vc1;
3086 std::pair<int, std::pair<int,int> > pt1,pc1;
3087 DataArrayInt *dt1=0,*dc1=0;
3089 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3090 MCAuto<DataArrayInt> ret;
3095 if(nbOfComponents==1)
3096 return PyInt_FromLong(self->getIJSafe(it1,0));
3097 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3100 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3102 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3104 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3106 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3109 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3110 std::vector<int> v2(1,ic1);
3111 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3115 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3116 std::vector<int> v2(1,ic1);
3117 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3121 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3122 std::vector<int> v2(1,ic1);
3123 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3127 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3128 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3132 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3133 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3137 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3138 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3142 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3143 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3147 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3148 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3149 std::vector<int> v2(nbOfComp);
3150 for(int i=0;i<nbOfComp;i++)
3151 v2[i]=pc1.first+i*pc1.second.second;
3152 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3156 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3157 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3158 std::vector<int> v2(nbOfComp);
3159 for(int i=0;i<nbOfComp;i++)
3160 v2[i]=pc1.first+i*pc1.second.second;
3161 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3165 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3166 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3167 std::vector<int> v2(nbOfComp);
3168 for(int i=0;i<nbOfComp;i++)
3169 v2[i]=pc1.first+i*pc1.second.second;
3170 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3174 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3175 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3176 std::vector<int> v2(nbOfComp);
3177 for(int i=0;i<nbOfComp;i++)
3178 v2[i]=pc1.first+i*pc1.second.second;
3179 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3182 throw INTERP_KERNEL::Exception(msg);
3186 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3188 self->checkAllocated();
3189 const char msg[]="Unexpected situation in __setitem__ !";
3190 int nbOfTuples=self->getNumberOfTuples();
3191 int nbOfComponents=self->getNumberOfComponents();
3194 std::vector<int> v1;
3196 DataArrayIntTuple *dd1=0;
3197 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3199 std::vector<int> vt1,vc1;
3200 std::pair<int, std::pair<int,int> > pt1,pc1;
3201 DataArrayInt *dt1=0,*dc1=0;
3202 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3203 MCAuto<DataArrayInt> tmp;
3211 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3214 tmp=DataArrayInt::New();
3215 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3216 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3219 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3222 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3223 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3226 throw INTERP_KERNEL::Exception(msg);
3235 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3238 tmp=DataArrayInt::New();
3239 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3240 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3243 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3246 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3247 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3250 throw INTERP_KERNEL::Exception(msg);
3259 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3262 tmp=DataArrayInt::New();
3263 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3264 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3267 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3270 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3271 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3274 throw INTERP_KERNEL::Exception(msg);
3283 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3286 tmp=DataArrayInt::New();
3287 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3288 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3291 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3294 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3295 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3298 throw INTERP_KERNEL::Exception(msg);
3307 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3310 tmp=DataArrayInt::New();
3311 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3312 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3315 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3318 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3319 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3322 throw INTERP_KERNEL::Exception(msg);
3331 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3334 tmp=DataArrayInt::New();
3335 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3336 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3339 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3342 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3343 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3346 throw INTERP_KERNEL::Exception(msg);
3355 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3358 tmp=DataArrayInt::New();
3359 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3360 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3363 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3366 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3367 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3370 throw INTERP_KERNEL::Exception(msg);
3379 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3382 tmp=DataArrayInt::New();
3383 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3384 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3387 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3390 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3391 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3394 throw INTERP_KERNEL::Exception(msg);
3403 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3406 tmp=DataArrayInt::New();
3407 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3408 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3411 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3414 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3415 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3418 throw INTERP_KERNEL::Exception(msg);
3427 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3430 tmp=DataArrayInt::New();
3431 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3432 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3435 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3438 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3439 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3442 throw INTERP_KERNEL::Exception(msg);
3451 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3454 tmp=DataArrayInt::New();
3455 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3456 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3459 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3462 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3463 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3466 throw INTERP_KERNEL::Exception(msg);
3475 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3478 tmp=DataArrayInt::New();
3479 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3480 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3483 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3486 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3487 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3490 throw INTERP_KERNEL::Exception(msg);
3499 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3502 tmp=DataArrayInt::New();
3503 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3504 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3507 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3510 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3511 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3514 throw INTERP_KERNEL::Exception(msg);
3523 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3526 tmp=DataArrayInt::New();
3527 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3528 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3531 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3534 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3535 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3538 throw INTERP_KERNEL::Exception(msg);
3547 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3550 tmp=DataArrayInt::New();
3551 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3552 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3555 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3558 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3559 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3562 throw INTERP_KERNEL::Exception(msg);
3571 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3574 tmp=DataArrayInt::New();
3575 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3576 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3579 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3582 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3583 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3586 throw INTERP_KERNEL::Exception(msg);
3591 throw INTERP_KERNEL::Exception(msg);
3596 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3598 return self->negate();
3601 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3603 const char msg[]="Unexpected situation in __add__ !";
3606 std::vector<int> aa;
3607 DataArrayIntTuple *aaa;
3609 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3614 MCAuto<DataArrayInt> ret=self->deepCopy();
3615 ret->applyLin(1,val);
3620 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3621 return DataArrayInt::Add(self,aaaa);
3625 return DataArrayInt::Add(self,a);
3629 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3630 return DataArrayInt::Add(self,aaaa);
3633 throw INTERP_KERNEL::Exception(msg);
3637 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3639 const char msg[]="Unexpected situation in __radd__ !";
3642 std::vector<int> aa;
3643 DataArrayIntTuple *aaa;
3645 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3650 MCAuto<DataArrayInt> ret=self->deepCopy();
3651 ret->applyLin(1,val);
3656 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3657 return DataArrayInt::Add(self,aaaa);
3661 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3662 return DataArrayInt::Add(self,aaaa);
3665 throw INTERP_KERNEL::Exception(msg);
3669 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3671 const char msg[]="Unexpected situation in __iadd__ !";
3674 std::vector<int> aa;
3675 DataArrayIntTuple *aaa;
3677 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3682 self->applyLin(1,val);
3683 Py_XINCREF(trueSelf);
3688 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3690 Py_XINCREF(trueSelf);
3696 Py_XINCREF(trueSelf);
3701 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3702 self->addEqual(aaaa);
3703 Py_XINCREF(trueSelf);
3707 throw INTERP_KERNEL::Exception(msg);
3711 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3713 const char msg[]="Unexpected situation in __sub__ !";
3716 std::vector<int> aa;
3717 DataArrayIntTuple *aaa;
3719 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3724 MCAuto<DataArrayInt> ret=self->deepCopy();
3725 ret->applyLin(1,-val);
3730 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3731 return DataArrayInt::Substract(self,aaaa);
3735 return DataArrayInt::Substract(self,a);
3739 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3740 return DataArrayInt::Substract(self,aaaa);
3743 throw INTERP_KERNEL::Exception(msg);
3747 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3749 const char msg[]="Unexpected situation in __rsub__ !";
3752 std::vector<int> aa;
3753 DataArrayIntTuple *aaa;
3755 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3760 MCAuto<DataArrayInt> ret=self->deepCopy();
3761 ret->applyLin(-1,val);
3766 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3767 return DataArrayInt::Substract(aaaa,self);
3771 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3772 return DataArrayInt::Substract(aaaa,self);
3775 throw INTERP_KERNEL::Exception(msg);
3779 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3781 const char msg[]="Unexpected situation in __isub__ !";
3784 std::vector<int> aa;
3785 DataArrayIntTuple *aaa;
3787 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3792 self->applyLin(1,-val);
3793 Py_XINCREF(trueSelf);
3798 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3799 self->substractEqual(bb);
3800 Py_XINCREF(trueSelf);
3805 self->substractEqual(a);
3806 Py_XINCREF(trueSelf);
3811 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3812 self->substractEqual(aaaa);
3813 Py_XINCREF(trueSelf);
3817 throw INTERP_KERNEL::Exception(msg);
3821 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3823 const char msg[]="Unexpected situation in __mul__ !";
3826 std::vector<int> aa;
3827 DataArrayIntTuple *aaa;
3829 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3834 MCAuto<DataArrayInt> ret=self->deepCopy();
3835 ret->applyLin(val,0);
3840 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3841 return DataArrayInt::Multiply(self,aaaa);
3845 return DataArrayInt::Multiply(self,a);
3849 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3850 return DataArrayInt::Multiply(self,aaaa);
3853 throw INTERP_KERNEL::Exception(msg);
3857 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3859 const char msg[]="Unexpected situation in __rmul__ !";
3862 std::vector<int> aa;
3863 DataArrayIntTuple *aaa;
3865 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3870 MCAuto<DataArrayInt> ret=self->deepCopy();
3871 ret->applyLin(val,0);
3876 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3877 return DataArrayInt::Multiply(self,aaaa);
3881 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3882 return DataArrayInt::Multiply(self,aaaa);
3885 throw INTERP_KERNEL::Exception(msg);
3889 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3891 const char msg[]="Unexpected situation in __imul__ !";
3894 std::vector<int> aa;
3895 DataArrayIntTuple *aaa;
3897 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3902 self->applyLin(val,0);
3903 Py_XINCREF(trueSelf);
3908 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3909 self->multiplyEqual(bb);
3910 Py_XINCREF(trueSelf);
3915 self->multiplyEqual(a);
3916 Py_XINCREF(trueSelf);
3921 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3922 self->multiplyEqual(aaaa);
3923 Py_XINCREF(trueSelf);
3927 throw INTERP_KERNEL::Exception(msg);
3931 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3933 const char msg[]="Unexpected situation in __div__ !";
3936 std::vector<int> aa;
3937 DataArrayIntTuple *aaa;
3939 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3944 MCAuto<DataArrayInt> ret=self->deepCopy();
3945 ret->applyDivideBy(val);
3950 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3951 return DataArrayInt::Divide(self,aaaa);
3955 return DataArrayInt::Divide(self,a);
3959 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3960 return DataArrayInt::Divide(self,aaaa);
3963 throw INTERP_KERNEL::Exception(msg);
3967 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3969 const char msg[]="Unexpected situation in __rdiv__ !";
3972 std::vector<int> aa;
3973 DataArrayIntTuple *aaa;
3975 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3980 MCAuto<DataArrayInt> ret=self->deepCopy();
3986 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3987 return DataArrayInt::Divide(aaaa,self);
3991 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3992 return DataArrayInt::Divide(aaaa,self);
3995 throw INTERP_KERNEL::Exception(msg);
3999 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4001 const char msg[]="Unexpected situation in __idiv__ !";
4004 std::vector<int> aa;
4005 DataArrayIntTuple *aaa;
4007 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4012 self->applyDivideBy(val);
4013 Py_XINCREF(trueSelf);
4018 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4019 self->divideEqual(bb);
4020 Py_XINCREF(trueSelf);
4025 self->divideEqual(a);
4026 Py_XINCREF(trueSelf);
4031 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4032 self->divideEqual(aaaa);
4033 Py_XINCREF(trueSelf);
4037 throw INTERP_KERNEL::Exception(msg);
4041 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4043 const char msg[]="Unexpected situation in __mod__ !";
4046 std::vector<int> aa;
4047 DataArrayIntTuple *aaa;
4049 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4054 MCAuto<DataArrayInt> ret=self->deepCopy();
4055 ret->applyModulus(val);
4060 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4061 return DataArrayInt::Modulus(self,aaaa);
4065 return DataArrayInt::Modulus(self,a);
4069 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4070 return DataArrayInt::Modulus(self,aaaa);
4073 throw INTERP_KERNEL::Exception(msg);
4077 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4079 const char msg[]="Unexpected situation in __rmod__ !";
4082 std::vector<int> aa;
4083 DataArrayIntTuple *aaa;
4085 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4090 MCAuto<DataArrayInt> ret=self->deepCopy();
4091 ret->applyRModulus(val);
4096 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4097 return DataArrayInt::Modulus(aaaa,self);
4101 return DataArrayInt::Modulus(a,self);
4105 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4106 return DataArrayInt::Modulus(aaaa,self);
4109 throw INTERP_KERNEL::Exception(msg);
4113 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4115 const char msg[]="Unexpected situation in __imod__ !";
4118 std::vector<int> aa;
4119 DataArrayIntTuple *aaa;
4121 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4126 self->applyModulus(val);
4127 Py_XINCREF(trueSelf);
4132 self->modulusEqual(a);
4133 Py_XINCREF(trueSelf);
4138 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4139 self->modulusEqual(aaaa);
4140 Py_XINCREF(trueSelf);
4144 throw INTERP_KERNEL::Exception(msg);
4148 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4150 const char msg[]="Unexpected situation in __pow__ !";
4153 std::vector<int> aa;
4154 DataArrayIntTuple *aaa;
4156 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4161 MCAuto<DataArrayInt> ret=self->deepCopy();
4167 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4168 return DataArrayInt::Pow(self,aaaa);
4172 return DataArrayInt::Pow(self,a);
4176 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4177 return DataArrayInt::Pow(self,aaaa);
4180 throw INTERP_KERNEL::Exception(msg);
4184 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4186 const char msg[]="Unexpected situation in __rpow__ !";
4189 std::vector<int> aa;
4190 DataArrayIntTuple *aaa;
4192 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4197 MCAuto<DataArrayInt> ret=self->deepCopy();
4198 ret->applyRPow(val);
4203 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4204 return DataArrayInt::Pow(aaaa,self);
4208 return DataArrayInt::Pow(a,self);
4212 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4213 return DataArrayInt::Pow(aaaa,self);
4216 throw INTERP_KERNEL::Exception(msg);
4220 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4222 const char msg[]="Unexpected situation in __ipow__ !";
4225 std::vector<int> aa;
4226 DataArrayIntTuple *aaa;
4228 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4233 self->applyPow(val);
4234 Py_XINCREF(trueSelf);
4240 Py_XINCREF(trueSelf);
4245 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4246 self->powEqual(aaaa);
4247 Py_XINCREF(trueSelf);
4251 throw INTERP_KERNEL::Exception(msg);
4255 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4257 std::ostringstream oss;
4258 self->reprQuickOverview(oss);
4262 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4264 int szArr,sw,iTypppArr;
4265 std::vector<int> stdvecTyyppArr;
4266 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4267 self->pushBackValsSilent(tmp,tmp+szArr);
4270 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4272 std::vector<int> ret1;
4273 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4274 std::size_t sz=ret0.size();
4275 PyObject *pyRet=PyTuple_New(2);
4276 PyObject *pyRet0=PyList_New((int)sz);
4277 PyObject *pyRet1=PyList_New((int)sz);
4278 for(std::size_t i=0;i<sz;i++)
4280 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4281 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4283 PyTuple_SetItem(pyRet,0,pyRet0);
4284 PyTuple_SetItem(pyRet,1,pyRet1);
4288 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4290 DataArrayInt *ret0=0,*ret1=0;
4291 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4292 PyObject *pyRet=PyTuple_New(2);
4293 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4294 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4298 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4301 bool ret(self->isRange(a,b,c));
4302 PyObject *pyRet=PyTuple_New(2);
4303 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4305 PyTuple_SetItem(pyRet,0,ret0Py);
4307 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4313 PyTuple_SetItem(pyRet,1,ret1Py);
4318 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4320 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4323 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4326 if(!self->isAllocated())
4327 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4328 PyObject *ret(PyTuple_New(1));
4329 PyObject *ret0(PyDict_New());
4330 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4331 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4332 PyObject *tmp1(PyInt_FromLong(0));
4333 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4334 PyTuple_SetItem(ret,0,ret0);
4338 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4344 class DataArrayIntTuple;
4346 class DataArrayIntIterator
4349 DataArrayIntIterator(DataArrayInt *da);
4350 ~DataArrayIntIterator();
4355 DataArrayIntTuple *ret=self->nextt();
4357 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4360 PyErr_SetString(PyExc_StopIteration,"No more data.");
4367 class DataArrayIntTuple
4370 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4371 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4374 std::string __str__() const throw(INTERP_KERNEL::Exception)
4376 return self->repr();
4379 int __int__() const throw(INTERP_KERNEL::Exception)
4381 return self->intValue();
4384 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4386 return self->buildDAInt(1,self->getNumberOfCompo());
4389 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4391 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4392 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4393 Py_XINCREF(trueSelf);
4397 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4399 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4400 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4401 Py_XINCREF(trueSelf);
4405 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4407 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4408 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4409 Py_XINCREF(trueSelf);
4413 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4415 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4416 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4417 Py_XINCREF(trueSelf);
4421 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4423 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4424 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4425 Py_XINCREF(trueSelf);
4429 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4431 return PyInt_FromLong(self->getNumberOfCompo());
4434 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4436 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4439 std::vector<int> multiVal;
4440 std::pair<int, std::pair<int,int> > slic;
4441 MEDCoupling::DataArrayInt *daIntTyypp=0;
4442 const int *pt=self->getConstPointer();
4443 int nbc=self->getNumberOfCompo();
4444 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4451 std::ostringstream oss;
4452 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4453 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4457 return PyInt_FromLong(pt[singleVal]);
4461 return PyInt_FromLong(pt[nbc+singleVal]);
4464 std::ostringstream oss;
4465 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4466 throw INTERP_KERNEL::Exception(oss.str().c_str());
4472 PyObject *t=PyTuple_New(multiVal.size());
4473 for(int j=0;j<(int)multiVal.size();j++)
4475 int cid=multiVal[j];
4478 std::ostringstream oss;
4479 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4480 throw INTERP_KERNEL::Exception(oss.str().c_str());
4482 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4488 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4489 PyObject *t=PyTuple_New(sz);
4490 for(int j=0;j<sz;j++)
4491 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4495 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4499 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4501 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4502 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4505 std::vector<int> multiValV;
4506 std::pair<int, std::pair<int,int> > slicV;
4507 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4508 int nbc=self->getNumberOfCompo();
4509 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4511 std::vector<int> multiVal;
4512 std::pair<int, std::pair<int,int> > slic;
4513 MEDCoupling::DataArrayInt *daIntTyypp=0;
4514 int *pt=self->getPointer();
4515 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4522 std::ostringstream oss;
4523 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4524 throw INTERP_KERNEL::Exception(oss.str().c_str());
4530 pt[singleVal]=singleValV;
4535 if(multiValV.size()!=1)
4537 std::ostringstream oss;
4538 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4539 throw INTERP_KERNEL::Exception(oss.str().c_str());
4541 pt[singleVal]=multiValV[0];
4546 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4550 throw INTERP_KERNEL::Exception(msg);
4559 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4563 std::ostringstream oss;
4564 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4565 throw INTERP_KERNEL::Exception(oss.str().c_str());
4573 if(multiVal.size()!=multiValV.size())
4575 std::ostringstream oss;
4576 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4577 throw INTERP_KERNEL::Exception(oss.str().c_str());
4579 for(int i=0;i<(int)multiVal.size();i++)
4581 int pos=multiVal[i];
4584 std::ostringstream oss;
4585 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4586 throw INTERP_KERNEL::Exception(oss.str().c_str());
4588 pt[multiVal[i]]=multiValV[i];
4594 const int *ptV=daIntTyyppV->getConstPointer();
4595 if(nbc>daIntTyyppV->getNumberOfCompo())
4597 std::ostringstream oss;
4598 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4599 throw INTERP_KERNEL::Exception(oss.str().c_str());
4601 std::copy(ptV,ptV+nbc,pt);
4605 throw INTERP_KERNEL::Exception(msg);
4610 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4615 for(int j=0;j<sz;j++)
4616 pt[slic.first+j*slic.second.second]=singleValV;
4621 if(sz!=(int)multiValV.size())
4623 std::ostringstream oss;
4624 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4625 throw INTERP_KERNEL::Exception(oss.str().c_str());
4627 for(int j=0;j<sz;j++)
4628 pt[slic.first+j*slic.second.second]=multiValV[j];
4633 const int *ptV=daIntTyyppV->getConstPointer();
4634 if(sz>daIntTyyppV->getNumberOfCompo())
4636 std::ostringstream oss;
4637 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4638 throw INTERP_KERNEL::Exception(oss.str().c_str());
4640 for(int j=0;j<sz;j++)
4641 pt[slic.first+j*slic.second.second]=ptV[j];
4645 throw INTERP_KERNEL::Exception(msg);
4649 throw INTERP_KERNEL::Exception(msg);
4655 class DataArrayChar : public DataArray
4658 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4659 int getHashCode() const throw(INTERP_KERNEL::Exception);
4660 bool empty() const throw(INTERP_KERNEL::Exception);
4661 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4662 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4663 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4664 char popBackSilent() throw(INTERP_KERNEL::Exception);
4665 void pack() const throw(INTERP_KERNEL::Exception);
4666 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4667 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4668 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4669 void reverse() throw(INTERP_KERNEL::Exception);
4670 void fillWithZero() throw(INTERP_KERNEL::Exception);
4671 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4672 std::string repr() const throw(INTERP_KERNEL::Exception);
4673 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4674 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4675 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4676 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4677 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4678 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4679 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4680 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4681 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4682 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4683 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4684 char front() const throw(INTERP_KERNEL::Exception);
4685 char back() const throw(INTERP_KERNEL::Exception);
4686 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4687 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4688 char *getPointer() throw(INTERP_KERNEL::Exception);
4689 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4690 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4691 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4692 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4693 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4694 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4695 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4696 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4697 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4698 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4699 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4702 int __len__() const throw(INTERP_KERNEL::Exception)
4704 if(self->isAllocated())
4706 return self->getNumberOfTuples();
4710 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4714 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4717 bool ret0=self->isEqualIfNotWhy(other,ret1);
4718 PyObject *ret=PyTuple_New(2);
4719 PyObject *ret0Py=ret0?Py_True:Py_False;
4721 PyTuple_SetItem(ret,0,ret0Py);
4722 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4726 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4729 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4730 if (!SWIG_IsOK(res1))
4733 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4734 if(size!=self->getNumberOfTuples())
4736 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4738 return self->renumber(tmp);
4742 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4744 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4745 da2->checkAllocated();
4746 int size=self->getNumberOfTuples();
4747 if(size!=self->getNumberOfTuples())
4749 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4751 return self->renumber(da2->getConstPointer());
4755 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4758 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4759 if (!SWIG_IsOK(res1))
4762 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4763 if(size!=self->getNumberOfTuples())
4765 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4767 return self->renumberR(tmp);
4771 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4773 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4774 da2->checkAllocated();
4775 int size=self->getNumberOfTuples();
4776 if(size!=self->getNumberOfTuples())
4778 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4780 return self->renumberR(da2->getConstPointer());
4784 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4787 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4788 if (!SWIG_IsOK(res1))
4791 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4792 if(size!=self->getNumberOfTuples())
4794 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4796 return self->renumberAndReduce(tmp,newNbOfTuple);
4800 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4802 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4803 da2->checkAllocated();
4804 int size=self->getNumberOfTuples();
4805 if(size!=self->getNumberOfTuples())
4807 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4809 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4813 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4815 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4816 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4817 return DataArrayChar::Aggregate(tmp);
4820 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4822 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4823 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4824 return DataArrayChar::Meld(tmp);
4829 class DataArrayByteIterator;
4831 class DataArrayByte : public DataArrayChar
4834 static DataArrayByte *New();
4835 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4836 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4837 char byteValue() const throw(INTERP_KERNEL::Exception);
4840 DataArrayByte() throw(INTERP_KERNEL::Exception)
4842 return DataArrayByte::New();
4845 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4847 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) !";
4848 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4852 if(PyInt_Check(nbOfTuples))
4854 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4856 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4859 if(PyInt_Check(nbOfComp))
4860 {//DataArrayByte.New([1,3,4,5],2,2)
4861 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4863 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4864 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4865 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4866 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4870 throw INTERP_KERNEL::Exception(msg);
4873 {//DataArrayByte.New([1,3,4],3)
4874 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4876 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4877 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4882 throw INTERP_KERNEL::Exception(msg);
4885 {// DataArrayByte.New([1,3,4])
4886 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4887 int tmpp1=-1,tmpp2=-1;
4888 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4889 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4893 else if(PyInt_Check(elt0))
4895 int nbOfTuples1=PyInt_AS_LONG(elt0);
4897 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4902 if(PyInt_Check(nbOfTuples))
4903 {//DataArrayByte.New(5,2)
4904 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4906 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4907 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4908 ret->alloc(nbOfTuples1,nbOfCompo);
4912 throw INTERP_KERNEL::Exception(msg);
4915 throw INTERP_KERNEL::Exception(msg);
4918 {//DataArrayByte.New(5)
4919 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4920 ret->alloc(nbOfTuples1,1);
4925 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4926 {//DataArrayDouble.New(numpyArray)
4927 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4931 throw INTERP_KERNEL::Exception(msg);
4934 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4936 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4939 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4941 std::ostringstream oss;
4942 self->reprQuickOverview(oss);
4946 int __int__() const throw(INTERP_KERNEL::Exception)
4948 return (int) self->byteValue();
4951 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4953 return self->iterator();
4956 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4958 return (int)self->getIJ(tupleId,compoId);
4961 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4963 return (int)self->getIJSafe(tupleId,compoId);
4966 std::string __str__() const throw(INTERP_KERNEL::Exception)
4968 return self->repr();
4971 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4973 const char *vals=self->getConstPointer();
4974 int nbOfComp=self->getNumberOfComponents();
4975 int nbOfTuples=self->getNumberOfTuples();
4976 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4979 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4982 int ival=-1; std::vector<int> ivval;
4983 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4984 std::vector<char> vals(sz);
4985 std::copy(pt,pt+sz,vals.begin());
4986 return self->presenceOfTuple(vals);
4989 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4992 int ival=-1; std::vector<int> ivval;
4993 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4994 std::vector<char> vals2(sz);
4995 std::copy(pt,pt+sz,vals2.begin());
4996 return self->presenceOfValue(vals2);
4999 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5002 int ival=-1; std::vector<int> ivval;
5003 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
5004 std::vector<char> vals2(sz);
5005 std::copy(pt,pt+sz,vals2.begin());
5006 return self->findIdFirstEqual(vals2);
5009 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5012 int ival=-1; std::vector<int> ivval;
5013 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
5014 std::vector<char> vals(sz);
5015 std::copy(pt,pt+sz,vals.begin());
5016 return self->findIdFirstEqualTuple(vals);
5019 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5022 int ival=-1; std::vector<int> ivval;
5023 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
5024 std::vector<char> vals(sz);
5025 std::copy(pt,pt+sz,vals.begin());
5026 return self->findIdSequence(vals);
5029 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5031 int sz=self->getNumberOfComponents();
5032 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5033 self->getTuple(tupleId,tmp);
5034 PyObject *ret=PyTuple_New(sz);
5035 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5039 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5042 int r1=(int)self->getMaxValue(tmp);
5043 PyObject *ret=PyTuple_New(2);
5044 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5045 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5049 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5052 int r1=(int)self->getMinValue(tmp);
5053 PyObject *ret=PyTuple_New(2);
5054 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5055 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5059 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5061 int nbOfCompo=self->getNumberOfComponents();
5066 if(PyInt_Check(obj))
5068 int val=(int)PyInt_AS_LONG(obj);
5069 return self->findIdFirstEqual(val);
5072 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5075 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5079 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5081 int nbOfCompo=self->getNumberOfComponents();
5088 if(PyInt_Check(obj))
5090 int val=(int)PyInt_AS_LONG(obj);
5091 return self->presenceOfValue(val);
5094 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5097 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5102 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5104 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5109 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5111 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5114 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5117 if(!self->isAllocated())
5118 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5119 PyObject *ret(PyTuple_New(1));
5120 PyObject *ret0(PyDict_New());
5121 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5122 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5123 PyObject *tmp1(PyInt_FromLong(0));
5124 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5125 PyTuple_SetItem(ret,0,ret0);
5129 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5133 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5135 self->checkAllocated();
5136 const char msg[]="Unexpected situation in __setitem__ !";
5137 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5140 std::vector<int> v1;
5142 DataArrayIntTuple *dd1=0;
5143 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5145 std::vector<int> vt1,vc1;
5146 std::pair<int, std::pair<int,int> > pt1,pc1;
5147 DataArrayInt *dt1=0,*dc1=0;
5148 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5149 MCAuto<DataArrayInt> tmp;
5157 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5160 throw INTERP_KERNEL::Exception(msg);
5169 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5172 throw INTERP_KERNEL::Exception(msg);
5181 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5184 throw INTERP_KERNEL::Exception(msg);
5193 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5196 throw INTERP_KERNEL::Exception(msg);
5205 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5208 throw INTERP_KERNEL::Exception(msg);
5217 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5220 throw INTERP_KERNEL::Exception(msg);
5229 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5232 throw INTERP_KERNEL::Exception(msg);
5241 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5244 throw INTERP_KERNEL::Exception(msg);
5253 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5256 throw INTERP_KERNEL::Exception(msg);
5265 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5268 throw INTERP_KERNEL::Exception(msg);
5277 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5280 throw INTERP_KERNEL::Exception(msg);
5289 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5292 throw INTERP_KERNEL::Exception(msg);
5301 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5304 throw INTERP_KERNEL::Exception(msg);
5313 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5316 throw INTERP_KERNEL::Exception(msg);
5325 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5328 throw INTERP_KERNEL::Exception(msg);
5337 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5340 throw INTERP_KERNEL::Exception(msg);
5345 throw INTERP_KERNEL::Exception(msg);
5352 class DataArrayByteTuple;
5354 class DataArrayByteIterator
5357 DataArrayByteIterator(DataArrayByte *da);
5358 ~DataArrayByteIterator();
5361 class DataArrayByteTuple
5364 std::string repr() const throw(INTERP_KERNEL::Exception);
5365 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5368 std::string __str__() const throw(INTERP_KERNEL::Exception)
5370 return self->repr();
5373 char __int__() const throw(INTERP_KERNEL::Exception)
5375 return self->byteValue();
5378 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5380 return self->buildDAByte(1,self->getNumberOfCompo());
5385 class DataArrayAsciiCharIterator;
5387 class DataArrayAsciiChar : public DataArrayChar
5390 static DataArrayAsciiChar *New();
5391 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5392 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5393 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5396 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5398 return DataArrayAsciiChar::New();
5401 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5403 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) !";
5404 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5408 if(PyInt_Check(nbOfTuples))
5410 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5412 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5415 if(PyInt_Check(nbOfComp))
5416 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5417 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5419 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5420 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5421 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5422 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5426 throw INTERP_KERNEL::Exception(msg);
5429 {//DataArrayAsciiChar.New([1,3,4],3)
5430 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5432 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5433 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5437 else if(PyString_Check(nbOfTuples))
5439 if(PyString_Size(nbOfTuples)!=1)
5440 throw INTERP_KERNEL::Exception(msg);
5441 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5442 std::vector<std::string> tmp;
5443 if(fillStringVector(elt0,tmp))
5444 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5446 throw INTERP_KERNEL::Exception(msg);
5449 throw INTERP_KERNEL::Exception(msg);
5453 std::vector<std::string> tmmp;
5454 if(fillStringVector(elt0,tmmp))
5455 //DataArrayAsciiChar.New(["abc","de","fghi"])
5456 return DataArrayAsciiChar::New(tmmp,' ');
5459 // DataArrayAsciiChar.New([1,3,4])
5460 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5461 int tmpp1=-1,tmpp2=-1;
5462 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5463 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5468 else if(PyInt_Check(elt0))
5470 int nbOfTuples1=PyInt_AS_LONG(elt0);
5472 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5477 if(PyInt_Check(nbOfTuples))
5478 {//DataArrayAsciiChar.New(5,2)
5479 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5481 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5482 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5483 ret->alloc(nbOfTuples1,nbOfCompo);
5487 throw INTERP_KERNEL::Exception(msg);
5490 throw INTERP_KERNEL::Exception(msg);
5493 {//DataArrayAsciiChar.New(5)
5494 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5495 ret->alloc(nbOfTuples1,1);
5500 throw INTERP_KERNEL::Exception(msg);
5503 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5505 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5508 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5510 std::ostringstream oss;
5511 self->reprQuickOverview(oss);
5515 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5517 return self->iterator();
5520 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5522 char tmp[2]; tmp[1]='\0';
5523 tmp[0]=self->getIJ(tupleId,compoId);
5524 return std::string(tmp);
5527 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5529 char tmp[2]; tmp[1]='\0';
5530 tmp[0]=self->getIJSafe(tupleId,compoId);
5531 return std::string(tmp);
5534 std::string __str__() const throw(INTERP_KERNEL::Exception)
5536 return self->repr();
5539 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5541 const char *vals=self->getConstPointer();
5542 int nbOfComp=self->getNumberOfComponents();
5543 int nbOfTuples=self->getNumberOfTuples();
5544 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5547 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5549 if(PyString_Check(tupl))
5551 Py_ssize_t sz=PyString_Size(tupl);
5552 std::vector<char> vals(sz);
5553 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5554 return self->presenceOfTuple(vals);
5557 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5560 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5562 if(PyString_Check(vals))
5564 Py_ssize_t sz=PyString_Size(vals);
5565 std::vector<char> vals2(sz);
5566 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5567 return self->presenceOfValue(vals2);
5570 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5573 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5575 if(PyString_Check(vals))
5577 Py_ssize_t sz=PyString_Size(vals);
5578 std::vector<char> vals2(sz);
5579 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5580 return self->findIdFirstEqual(vals2);
5583 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5586 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5588 if(PyString_Check(tupl))
5590 Py_ssize_t sz=PyString_Size(tupl);
5591 std::vector<char> vals(sz);
5592 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5593 return self->findIdFirstEqualTuple(vals);
5596 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5599 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5601 if(PyString_Check(strOrListOfInt))
5603 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5604 std::vector<char> vals(sz);
5605 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5606 return self->findIdSequence(vals);
5609 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5612 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5614 int sz=self->getNumberOfComponents();
5615 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5616 self->getTuple(tupleId,tmp);
5617 return PyString_FromString(tmp);
5620 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5623 char tmp2[2]; tmp2[1]='\0';
5624 tmp2[0]=self->getMaxValue(tmp);
5625 PyObject *ret=PyTuple_New(2);
5626 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5627 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5631 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5634 char tmp2[2]; tmp2[1]='\0';
5635 tmp2[0]=self->getMinValue(tmp);
5636 PyObject *ret=PyTuple_New(2);
5637 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5638 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5642 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5644 int nbOfCompo=self->getNumberOfComponents();
5649 if(PyString_Check(obj))
5651 Py_ssize_t sz=PyString_Size(obj);
5652 char *pt=PyString_AsString(obj);
5654 return self->findIdFirstEqual(pt[0]);
5656 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5659 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5662 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5666 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5668 int nbOfCompo=self->getNumberOfComponents();
5675 if(PyString_Check(obj))
5677 Py_ssize_t sz=PyString_Size(obj);
5678 char *pt=PyString_AsString(obj);
5680 return self->presenceOfValue(pt[0]);
5682 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5685 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5688 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5692 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5695 std::vector<int> stdvecTyyppArr;
5696 std::pair<int, std::pair<int,int> > sTyyppArr;
5697 MEDCoupling::DataArrayInt *daIntTyypp=0;
5698 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5702 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5704 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5706 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5708 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5710 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5714 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5716 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.";
5718 std::vector<int> stdvecTyyppArr;
5719 std::pair<int, std::pair<int,int> > sTyyppArr;
5720 MEDCoupling::DataArrayInt *daIntTyypp=0;
5721 int nbOfCompo=self->getNumberOfComponents();
5722 int nbOfTuples=self->getNumberOfTuples();
5723 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5725 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5726 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5735 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5741 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5742 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5745 //value vector<string>
5748 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5749 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5752 //value DataArrayChar
5755 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5759 throw INTERP_KERNEL::Exception(msg);
5763 {//obj list-tuple[int]
5769 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5775 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5776 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5779 //value vector<string>
5782 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5783 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5786 //value DataArrayChar
5789 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5793 throw INTERP_KERNEL::Exception(msg);
5804 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5810 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5811 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5814 //value vector<string>
5817 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5818 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5821 //value DataArrayChar
5824 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5828 throw INTERP_KERNEL::Exception(msg);
5839 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5845 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5846 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5849 //value vector<string>
5852 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5853 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5856 //value DataArrayChar
5859 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5863 throw INTERP_KERNEL::Exception(msg);
5868 throw INTERP_KERNEL::Exception(msg);
5874 class DataArrayAsciiCharTuple;
5876 class DataArrayAsciiCharIterator
5879 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5880 ~DataArrayAsciiCharIterator();
5885 DataArrayAsciiCharTuple *ret=self->nextt();
5887 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5890 PyErr_SetString(PyExc_StopIteration,"No more data.");
5897 class DataArrayAsciiCharTuple
5900 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5901 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5904 std::string __str__() const throw(INTERP_KERNEL::Exception)
5906 return self->repr();
5909 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5911 return self->buildDAAsciiChar(1,self->getNumberOfCompo());