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);
45 %newobject MEDCoupling::DataArray::deepCopy;
46 %newobject MEDCoupling::DataArray::buildNewEmptyInstance;
47 %newobject MEDCoupling::DataArray::selectByTupleRanges;
48 %newobject MEDCoupling::DataArray::selectByTupleId;
49 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
50 %newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
51 %newobject MEDCoupling::DataArray::Aggregate;
52 %newobject MEDCoupling::DataArrayFloat::New;
53 %newobject MEDCoupling::DataArrayFloat::iterator;
54 %newobject MEDCoupling::DataArrayFloat::__iter__;
55 %newobject MEDCoupling::DataArrayInt::New;
56 %newobject MEDCoupling::DataArrayInt::__iter__;
57 %newobject MEDCoupling::DataArrayInt::selectPartDef;
58 %newobject MEDCoupling::DataArrayInt::convertToDblArr;
59 %newobject MEDCoupling::DataArrayInt::convertToFloatArr;
60 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
61 %newobject MEDCoupling::DataArrayInt::subArray;
62 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
63 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
64 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
65 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
66 %newobject MEDCoupling::DataArrayInt::renumber;
67 %newobject MEDCoupling::DataArrayInt::renumberR;
68 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
69 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
70 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
71 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
72 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
73 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
74 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
75 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
76 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
77 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
78 %newobject MEDCoupling::DataArrayInt::negate;
79 %newobject MEDCoupling::DataArrayInt::computeAbs;
80 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
81 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
82 %newobject MEDCoupling::DataArrayInt::findIdsStricltyNegative;
83 %newobject MEDCoupling::DataArrayInt::Aggregate;
84 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
85 %newobject MEDCoupling::DataArrayInt::Meld;
86 %newobject MEDCoupling::DataArrayInt::Add;
87 %newobject MEDCoupling::DataArrayInt::Substract;
88 %newobject MEDCoupling::DataArrayInt::Multiply;
89 %newobject MEDCoupling::DataArrayInt::Divide;
90 %newobject MEDCoupling::DataArrayInt::Pow;
91 %newobject MEDCoupling::DataArrayInt::BuildUnion;
92 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
93 %newobject MEDCoupling::DataArrayInt::Range;
94 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
95 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
96 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
97 %newobject MEDCoupling::DataArrayInt::buildComplement;
98 %newobject MEDCoupling::DataArrayInt::buildUnion;
99 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
100 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
101 %newobject MEDCoupling::DataArrayInt::buildIntersection;
102 %newobject MEDCoupling::DataArrayInt::buildUnique;
103 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
104 %newobject MEDCoupling::DataArrayInt::fromLinkedListOfPairToList;
105 %newobject MEDCoupling::DataArrayInt::findIdsGreaterOrEqualTo;
106 %newobject MEDCoupling::DataArrayInt::findIdsGreaterThan;
107 %newobject MEDCoupling::DataArrayInt::findIdsLowerOrEqualTo;
108 %newobject MEDCoupling::DataArrayInt::findIdsLowerThan;
109 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
110 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
111 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
112 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
113 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
114 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
115 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
116 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
117 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
118 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
119 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
120 %newobject MEDCoupling::DataArrayInt::__neg__;
121 %newobject MEDCoupling::DataArrayInt::__add__;
122 %newobject MEDCoupling::DataArrayInt::__radd__;
123 %newobject MEDCoupling::DataArrayInt::__sub__;
124 %newobject MEDCoupling::DataArrayInt::__rsub__;
125 %newobject MEDCoupling::DataArrayInt::__mul__;
126 %newobject MEDCoupling::DataArrayInt::__rmul__;
127 %newobject MEDCoupling::DataArrayInt::__div__;
128 %newobject MEDCoupling::DataArrayInt::__rdiv__;
129 %newobject MEDCoupling::DataArrayInt::__mod__;
130 %newobject MEDCoupling::DataArrayInt::__rmod__;
131 %newobject MEDCoupling::DataArrayInt::__pow__;
132 %newobject MEDCoupling::DataArrayInt::__rpow__;
133 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
134 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
135 %newobject MEDCoupling::DataArrayChar::renumber;
136 %newobject MEDCoupling::DataArrayChar::renumberR;
137 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
138 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
139 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
140 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
141 %newobject MEDCoupling::DataArrayChar::Aggregate;
142 %newobject MEDCoupling::DataArrayChar::Meld;
143 %newobject MEDCoupling::DataArrayByte::New;
144 %newobject MEDCoupling::DataArrayByte::__iter__;
145 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
146 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
147 %newobject MEDCoupling::DataArrayChar::subArray;
148 %newobject MEDCoupling::DataArrayAsciiChar::New;
149 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
150 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
151 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
152 %newobject MEDCoupling::DataArrayDouble::New;
153 %newobject MEDCoupling::DataArrayDouble::__iter__;
154 %newobject MEDCoupling::DataArrayDouble::selectPartDef;
155 %newobject MEDCoupling::DataArrayDouble::convertToIntArr;
156 %newobject MEDCoupling::DataArrayDouble::convertToFloatArr;
157 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
158 %newobject MEDCoupling::DataArrayDouble::Aggregate;
159 %newobject MEDCoupling::DataArrayDouble::Meld;
160 %newobject MEDCoupling::DataArrayDouble::Dot;
161 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
162 %newobject MEDCoupling::DataArrayDouble::Add;
163 %newobject MEDCoupling::DataArrayDouble::Substract;
164 %newobject MEDCoupling::DataArrayDouble::Multiply;
165 %newobject MEDCoupling::DataArrayDouble::Divide;
166 %newobject MEDCoupling::DataArrayDouble::Pow;
167 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
168 %newobject MEDCoupling::DataArrayDouble::subArray;
169 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
170 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
171 %newobject MEDCoupling::DataArrayDouble::cumSum;
172 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
173 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
174 %newobject MEDCoupling::DataArrayDouble::negate;
175 %newobject MEDCoupling::DataArrayDouble::computeAbs;
176 %newobject MEDCoupling::DataArrayDouble::applyFunc;
177 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
178 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
179 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
180 %newobject MEDCoupling::DataArrayDouble::determinant;
181 %newobject MEDCoupling::DataArrayDouble::eigenValues;
182 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
183 %newobject MEDCoupling::DataArrayDouble::inverse;
184 %newobject MEDCoupling::DataArrayDouble::trace;
185 %newobject MEDCoupling::DataArrayDouble::deviator;
186 %newobject MEDCoupling::DataArrayDouble::magnitude;
187 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
188 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
189 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
190 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
191 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
192 %newobject MEDCoupling::DataArrayDouble::renumber;
193 %newobject MEDCoupling::DataArrayDouble::renumberR;
194 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
195 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
196 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
197 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
198 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
199 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
200 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
201 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
202 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
203 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
204 %newobject MEDCoupling::DataArrayDouble::cartesianize;
205 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
206 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
207 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
208 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
209 %newobject MEDCoupling::DataArrayDouble::__neg__;
210 %newobject MEDCoupling::DataArrayDouble::__radd__;
211 %newobject MEDCoupling::DataArrayDouble::__rsub__;
212 %newobject MEDCoupling::DataArrayDouble::__rmul__;
213 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
214 %newobject MEDCoupling::DataArrayDouble::__pow__;
215 %newobject MEDCoupling::DataArrayDouble::__rpow__;
216 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
218 %newobject MEDCoupling::PartDefinition::New;
219 %newobject MEDCoupling::PartDefinition::toDAI;
220 %newobject MEDCoupling::PartDefinition::__add__;
221 %newobject MEDCoupling::PartDefinition::composeWith;
222 %newobject MEDCoupling::PartDefinition::tryToSimplify;
223 %newobject MEDCoupling::DataArrayPartDefinition::New;
224 %newobject MEDCoupling::SlicePartDefinition::New;
227 %feature("unref") DataArray "$this->decrRef();"
228 %feature("unref") DataArrayDouble "$this->decrRef();"
229 %feature("unref") DataArrayInt "$this->decrRef();"
230 %feature("unref") DataArrayChar "$this->decrRef();"
231 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
232 %feature("unref") DataArrayByte "$this->decrRef();"
234 %feature("unref") PartDefinition "$this->decrRef();"
235 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
236 %feature("unref") SlicePartDefinition "$this->decrRef();"
238 namespace MEDCoupling
245 } MEDCouplingAxisType;
249 class PartDefinition : public RefCountObject, public TimeLabel
252 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
253 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
254 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
255 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
256 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
257 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
258 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
259 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
262 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
264 return (*self)+other;
267 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
270 bool ret0(self->isEqual(other,ret1));
271 PyObject *ret=PyTuple_New(2);
272 PyObject *ret0Py=ret0?Py_True:Py_False;
274 PyTuple_SetItem(ret,0,ret0Py);
275 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
279 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
281 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
285 virtual ~PartDefinition();
288 class DataArrayPartDefinition : public PartDefinition
291 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
294 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
296 return DataArrayPartDefinition::New(listOfIds);
299 std::string __str__() const throw(INTERP_KERNEL::Exception)
301 return self->getRepr();
304 std::string __repr__() const throw(INTERP_KERNEL::Exception)
306 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
307 oss << self->getRepr();
312 virtual ~DataArrayPartDefinition();
315 class SlicePartDefinition : public PartDefinition
318 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
319 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
322 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
324 return SlicePartDefinition::New(start,stop,step);
327 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
330 self->getSlice(a,b,c);
331 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
334 std::string __str__() const throw(INTERP_KERNEL::Exception)
336 return self->getRepr();
339 std::string __repr__() const throw(INTERP_KERNEL::Exception)
341 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
342 oss << self->getRepr();
347 virtual ~SlicePartDefinition();
350 class DataArray : public RefCountObject, public TimeLabel
353 void setName(const std::string& name);
354 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
355 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
356 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
357 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
358 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
359 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
360 std::string getName() const;
361 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
362 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
363 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
364 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
365 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
366 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
367 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
368 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
369 int getNumberOfComponents() const;
370 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
371 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
372 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
373 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
374 virtual void desallocate() throw(INTERP_KERNEL::Exception);
375 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
376 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
377 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
378 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
379 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
380 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
381 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
382 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
383 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
384 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
385 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
386 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
387 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
388 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
389 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
390 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
391 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
392 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
393 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
394 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
395 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
396 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
397 void updateTime() const;
400 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
402 const std::vector<std::string>& comps=self->getInfoOnComponents();
403 PyObject *ret=PyList_New((int)comps.size());
404 for(int i=0;i<(int)comps.size();i++)
405 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
409 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
411 std::vector<int> tmp;
412 convertPyToNewIntArr3(li,tmp);
413 self->copyPartOfStringInfoFrom(other,tmp);
416 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
418 std::vector<int> tmp;
419 convertPyToNewIntArr3(li,tmp);
420 self->copyPartOfStringInfoFrom2(tmp,other);
423 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
426 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
427 if (!SWIG_IsOK(res1))
430 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
431 if(size!=self->getNumberOfTuples())
433 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
435 self->renumberInPlace(tmp);
439 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
441 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
442 da2->checkAllocated();
443 int size=self->getNumberOfTuples();
444 if(size!=self->getNumberOfTuples())
446 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
448 self->renumberInPlace(da2->getConstPointer());
452 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
455 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
456 if (!SWIG_IsOK(res1))
459 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
460 if(size!=self->getNumberOfTuples())
462 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
464 self->renumberInPlaceR(tmp);
468 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
470 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
471 da2->checkAllocated();
472 int size=self->getNumberOfTuples();
473 if(size!=self->getNumberOfTuples())
475 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
477 self->renumberInPlaceR(da2->getConstPointer());
481 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
482 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
484 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
485 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
486 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
487 DataArrayInt *tuplesSelecPtr2=0;
490 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
492 throw INTERP_KERNEL::Exception(msg);
494 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
497 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
499 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
500 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
503 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
505 std::vector<std::pair<int,int> > ranges;
506 convertPyToVectorPairInt(li,ranges);
507 return self->selectByTupleRanges(ranges);
510 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
513 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
514 if (!SWIG_IsOK(res1))
517 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
518 return self->selectByTupleId(tmp,tmp+size);
522 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
524 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
525 da2->checkAllocated();
526 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
530 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
533 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
534 if (!SWIG_IsOK(res1))
537 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
538 return self->selectByTupleIdSafe(tmp,tmp+size);
542 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
544 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
545 da2->checkAllocated();
546 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
550 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
552 std::vector<int> tmp;
553 convertPyToNewIntArr3(li,tmp);
554 DataArray *ret=self->keepSelectedComponents(tmp);
555 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
558 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
560 if(!PySlice_Check(slic))
561 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
562 Py_ssize_t strt=2,stp=2,step=2;
563 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
564 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
566 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
567 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
570 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
572 if(!PySlice_Check(slic))
573 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
574 Py_ssize_t strt=2,stp=2,step=2;
575 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
576 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
578 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
579 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
582 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
584 if(!PySlice_Check(slic))
585 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
586 Py_ssize_t strt=2,stp=2,step=2;
587 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
588 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
589 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
592 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
594 if(!PySlice_Check(slic))
595 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
596 Py_ssize_t strt=2,stp=2,step=2;
597 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
598 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
599 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
602 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
604 std::vector<const DataArray *> tmp;
605 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
606 return DataArray::Aggregate(tmp);
609 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
611 if(!PySlice_Check(slic))
612 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (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 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
616 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
619 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
621 if(!PySlice_Check(slic))
622 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
623 Py_ssize_t strt=2,stp=2,step=2;
624 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
625 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
626 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
629 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
631 PyObject *ret(PyTuple_New(2));
632 std::string a0(self->getName());
633 const std::vector<std::string> &a1(self->getInfoOnComponents());
634 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
637 PyObject *ret1(PyList_New(sz));
638 for(int i=0;i<sz;i++)
639 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
640 PyTuple_SetItem(ret,1,ret1);
645 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
647 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 !";
648 if(!PyTuple_Check(inp))
649 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
650 int sz(PyTuple_Size(inp));
652 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
653 PyObject *a0(PyTuple_GetItem(inp,0));
654 if(!PyString_Check(a0))
655 throw INTERP_KERNEL::Exception(MSG);
656 PyObject *a1(PyTuple_GetItem(inp,1));
657 std::vector<std::string> a1cpp;
658 if(!fillStringVector(a1,a1cpp))
659 throw INTERP_KERNEL::Exception(MSG);
660 self->setName(PyString_AsString(a0));
661 self->setInfoOnComponents(a1cpp);
666 class DataArrayFloat : public DataArray
669 static DataArrayFloat *New();
670 void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
671 bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
672 bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
673 bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
674 void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
675 void iota(float init=0.) throw(INTERP_KERNEL::Exception);
676 DataArrayFloatIterator *iterator() throw(INTERP_KERNEL::Exception);
679 DataArrayFloat() throw(INTERP_KERNEL::Exception)
681 return DataArrayFloat::New();
684 static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
686 return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
689 DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
691 return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
694 DataArrayFloatIterator *__iter__() throw(INTERP_KERNEL::Exception)
696 return self->iterator();
699 std::string __repr__() const throw(INTERP_KERNEL::Exception)
701 std::ostringstream oss;
702 self->reprQuickOverview(oss);
706 std::string __str__() const throw(INTERP_KERNEL::Exception)
708 return self->reprNotTooLong();
711 int __len__() const throw(INTERP_KERNEL::Exception)
713 if(self->isAllocated())
715 return self->getNumberOfTuples();
719 throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
723 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
725 const float *vals(self->begin());
726 return convertDblArrToPyList<float>(vals,self->getNbOfElems());
729 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
731 const float *vals(self->begin());
732 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
733 return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
736 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
738 return DataArrayT__getitem<float>(self,obj);
741 DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
743 return DataArrayT__setitem__<float>(self,obj,value);
746 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
748 return DataArrayT_imul<float>(trueSelf,obj,self);
752 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
754 return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
761 class DataArrayFloatTuple;
763 class DataArrayFloatIterator
766 DataArrayFloatIterator(DataArrayFloat *da);
767 ~DataArrayFloatIterator();
772 DataArrayFloatTuple *ret=self->nextt();
774 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple,SWIG_POINTER_OWN|0);
777 PyErr_SetString(PyExc_StopIteration,"No more data.");
784 class DataArrayFloatTuple
787 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
788 DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
791 std::string __str__() const throw(INTERP_KERNEL::Exception)
796 float __float__() const throw(INTERP_KERNEL::Exception)
798 return self->floatValue();
801 DataArrayFloat *buildDAFloat() throw(INTERP_KERNEL::Exception)
803 return self->buildDAFloat(1,self->getNumberOfCompo());
806 /*PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
808 MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
809 MEDCoupling_DataArrayFloat____imul___(ret,0,obj);
810 Py_XINCREF(trueSelf);
814 PyObject *__len__() throw(INTERP_KERNEL::Exception)
816 return PyInt_FromLong(self->getNumberOfCompo());
822 class DataArrayDoubleIterator;
824 class DataArrayDouble : public DataArray
827 static DataArrayDouble *New();
828 double doubleValue() const throw(INTERP_KERNEL::Exception);
829 bool empty() const throw(INTERP_KERNEL::Exception);
830 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
831 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
832 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
833 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
834 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
835 double popBackSilent() throw(INTERP_KERNEL::Exception);
836 void pack() const throw(INTERP_KERNEL::Exception);
837 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
838 void fillWithZero() throw(INTERP_KERNEL::Exception);
839 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
840 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
841 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
842 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
843 void reverse() throw(INTERP_KERNEL::Exception);
844 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
845 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
846 std::string repr() const throw(INTERP_KERNEL::Exception);
847 std::string reprZip() const throw(INTERP_KERNEL::Exception);
848 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
849 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
850 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
851 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
852 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
853 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
854 void transpose() throw(INTERP_KERNEL::Exception);
855 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
856 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
857 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
858 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
859 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
860 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
861 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
862 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
863 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
864 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
865 double front() const throw(INTERP_KERNEL::Exception);
866 double back() const throw(INTERP_KERNEL::Exception);
867 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
868 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
869 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
870 double *getPointer() throw(INTERP_KERNEL::Exception);
871 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
872 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
873 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
874 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
875 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
876 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
877 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
878 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
879 double getAverageValue() const throw(INTERP_KERNEL::Exception);
880 double norm2() const throw(INTERP_KERNEL::Exception);
881 double normMax() const throw(INTERP_KERNEL::Exception);
882 double normMin() const throw(INTERP_KERNEL::Exception);
883 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
884 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
885 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
886 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
887 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
888 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
889 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
890 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
891 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
892 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
893 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
894 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
895 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
896 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
897 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
898 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
899 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
900 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
901 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
902 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
903 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
904 void abs() throw(INTERP_KERNEL::Exception);
905 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
906 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
907 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
908 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
909 void applyPow(double val) throw(INTERP_KERNEL::Exception);
910 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
911 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
912 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
913 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
914 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
915 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
916 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
917 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
918 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
919 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
920 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
921 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
922 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
923 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
924 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
925 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
926 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
927 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
928 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
929 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
930 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
931 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
932 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
933 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
934 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
935 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
936 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
937 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
940 DataArrayDouble() throw(INTERP_KERNEL::Exception)
942 return DataArrayDouble::New();
945 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
947 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
950 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
952 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
955 DataArrayDouble *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
957 MCAuto<DataArrayDouble> ret(self->selectPartDef(pd));
961 DataArrayDouble *cumSum() const throw(INTERP_KERNEL::Exception)
963 MCAuto<DataArrayDouble> ret(self->cumSum());
967 DataArrayFloat *convertToFloatArr() const throw(INTERP_KERNEL::Exception)
969 MCAuto<DataArrayFloat> ret(self->convertToFloatArr());
973 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception)
975 MCAuto<DataArrayInt> ret(self->convertToIntArr());
979 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
982 std::vector<double> bb;
984 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
985 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
986 self->pushBackValsSilent(tmp,tmp+nbTuples);
989 std::string __repr__() const throw(INTERP_KERNEL::Exception)
991 std::ostringstream oss;
992 self->reprQuickOverview(oss);
996 std::string __str__() const throw(INTERP_KERNEL::Exception)
998 return self->reprNotTooLong();
1001 double __float__() const throw(INTERP_KERNEL::Exception)
1003 return self->doubleValue();
1006 int __len__() const throw(INTERP_KERNEL::Exception)
1008 if(self->isAllocated())
1010 return self->getNumberOfTuples();
1014 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
1018 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
1020 return self->iterator();
1023 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1025 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 !";
1026 if(PyList_Check(li) || PyTuple_Check(li))
1030 if(PyInt_Check(nbOfTuples))
1032 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1034 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
1037 if(PyInt_Check(nbOfComp))
1038 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
1039 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1041 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
1042 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
1043 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1046 throw INTERP_KERNEL::Exception(msg);
1049 {//DataArrayDouble.setValues([1.,3.,4.],3)
1051 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
1052 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1056 throw INTERP_KERNEL::Exception(msg);
1059 {// DataArrayDouble.setValues([1.,3.,4.])
1060 int tmpp1=-1,tmpp2=-1;
1061 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
1062 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1066 throw INTERP_KERNEL::Exception(msg);
1069 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
1071 const double *vals(self->begin());
1072 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
1076 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
1078 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1082 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1085 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1086 PyObject *ret=PyTuple_New(2);
1087 PyObject *ret0Py=ret0?Py_True:Py_False;
1089 PyTuple_SetItem(ret,0,ret0Py);
1090 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1094 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1096 const double *vals(self->begin());
1097 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1098 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1101 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1103 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1105 DataArrayDouble *a,*a2;
1106 DataArrayDoubleTuple *aa,*aa2;
1107 std::vector<double> bb,bb2;
1109 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1110 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1111 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1115 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1117 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1119 DataArrayDouble *a,*a2;
1120 DataArrayDoubleTuple *aa,*aa2;
1121 std::vector<double> bb,bb2;
1123 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1125 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1126 return convertDblArrToPyListOfTuple<double>(res,3,3);
1129 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1131 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1133 DataArrayDouble *a,*a2;
1134 DataArrayDoubleTuple *aa,*aa2;
1135 std::vector<double> bb,bb2;
1137 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1138 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1139 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1142 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1145 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1146 if (!SWIG_IsOK(res1))
1149 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1150 if(size!=self->getNumberOfTuples())
1152 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1154 return self->renumber(tmp);
1158 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1160 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1161 da2->checkAllocated();
1162 int size=self->getNumberOfTuples();
1163 if(size!=self->getNumberOfTuples())
1165 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1167 return self->renumber(da2->getConstPointer());
1171 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1174 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1175 if (!SWIG_IsOK(res1))
1178 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1179 if(size!=self->getNumberOfTuples())
1181 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1183 return self->renumberR(tmp);
1187 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1189 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1190 da2->checkAllocated();
1191 int size=self->getNumberOfTuples();
1192 if(size!=self->getNumberOfTuples())
1194 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1196 return self->renumberR(da2->getConstPointer());
1200 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1203 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1204 if (!SWIG_IsOK(res1))
1207 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1208 if(size!=self->getNumberOfTuples())
1210 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1212 return self->renumberAndReduce(tmp,newNbOfTuple);
1216 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1218 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1219 da2->checkAllocated();
1220 int size=self->getNumberOfTuples();
1221 if(size!=self->getNumberOfTuples())
1223 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1225 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1229 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1231 int thisTupleId,otherTupleId;
1232 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1233 PyObject *ret=PyTuple_New(3);
1234 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1235 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1236 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1240 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1243 double r1=self->getMaxValue(tmp);
1244 PyObject *ret=PyTuple_New(2);
1245 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1246 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1250 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1253 double r1=self->getMaxValue2(tmp);
1254 PyObject *ret=PyTuple_New(2);
1255 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1256 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1260 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1263 double r1=self->getMinValue(tmp);
1264 PyObject *ret=PyTuple_New(2);
1265 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1266 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1270 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1273 double r1=self->getMinValue2(tmp);
1274 PyObject *ret=PyTuple_New(2);
1275 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1276 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1280 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1282 int nbOfCompo(self->getNumberOfComponents());
1283 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1284 self->getMinMaxPerComponent(tmp);
1285 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1289 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1291 int sz=self->getNumberOfComponents();
1292 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1293 self->accumulate(tmp);
1294 return convertDblArrToPyList<double>(tmp,sz);
1297 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1300 std::vector<int> val2;
1301 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1302 return self->accumulatePerChunck(bg,bg+sz);
1305 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1307 DataArrayInt *comm, *commIndex;
1308 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1309 PyObject *res = PyList_New(2);
1310 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1311 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1315 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1319 DataArrayDoubleTuple *aa;
1320 std::vector<double> bb;
1322 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1323 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1325 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1326 PyObject *ret=PyTuple_New(2);
1327 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1328 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1332 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1334 std::vector<int> tmp;
1335 convertPyToNewIntArr3(li,tmp);
1336 self->setSelectedComponents(a,tmp);
1339 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1341 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1342 std::size_t sz(retCpp.size());
1343 PyObject *res(PyList_New(sz));
1344 for(std::size_t i=0;i<sz;i++)
1345 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1349 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1351 int sz=self->getNumberOfComponents();
1352 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1353 self->getTuple(tupleId,tmp);
1354 return convertDblArrToPyList<double>(tmp,sz);
1357 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1359 std::vector<const DataArrayDouble *> tmp;
1360 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1361 return DataArrayDouble::Aggregate(tmp);
1364 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1366 std::vector<const DataArrayDouble *> tmp;
1367 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1368 return DataArrayDouble::Meld(tmp);
1371 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1375 DataArrayDoubleTuple *aa;
1376 std::vector<double> bb;
1378 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1379 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1380 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1381 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1382 DataArrayInt *c=0,*cI=0;
1383 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1384 PyObject *ret=PyTuple_New(2);
1385 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1386 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1390 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1392 DataArrayInt *ret1=0;
1393 bool ret0=self->areIncludedInMe(other,prec,ret1);
1394 PyObject *ret=PyTuple_New(2);
1395 PyObject *ret0Py=ret0?Py_True:Py_False;
1397 PyTuple_SetItem(ret,0,ret0Py);
1398 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1402 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1404 return DataArrayT__getitem<double>(self,obj);
1407 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1409 return DataArrayT__setitem__<double>(self,obj,value);
1412 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1414 return self->negate();
1417 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1419 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1422 DataArrayDoubleTuple *aa;
1423 std::vector<double> bb;
1426 #ifndef WITHOUT_AUTOFIELD
1428 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1430 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1433 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1434 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1436 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1439 throw INTERP_KERNEL::Exception(msg);
1443 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1448 MCAuto<DataArrayDouble> ret=self->deepCopy();
1449 ret->applyLin(1.,val);
1450 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1454 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1458 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1459 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1463 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1464 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1467 throw INTERP_KERNEL::Exception(msg);
1471 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1473 const char msg[]="Unexpected situation in __radd__ !";
1476 DataArrayDoubleTuple *aa;
1477 std::vector<double> bb;
1479 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1484 MCAuto<DataArrayDouble> ret=self->deepCopy();
1485 ret->applyLin(1.,val);
1490 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1491 return DataArrayDouble::Add(self,aaa);
1495 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1496 return DataArrayDouble::Add(self,aaa);
1499 throw INTERP_KERNEL::Exception(msg);
1503 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1505 const char msg[]="Unexpected situation in __iadd__ !";
1508 DataArrayDoubleTuple *aa;
1509 std::vector<double> bb;
1511 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1516 self->applyLin(1.,val);
1517 Py_XINCREF(trueSelf);
1523 Py_XINCREF(trueSelf);
1528 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1529 self->addEqual(aaa);
1530 Py_XINCREF(trueSelf);
1535 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1536 self->addEqual(aaa);
1537 Py_XINCREF(trueSelf);
1541 throw INTERP_KERNEL::Exception(msg);
1545 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1547 const char msg[]="Unexpected situation in __sub__ !";
1550 DataArrayDoubleTuple *aa;
1551 std::vector<double> bb;
1554 #ifndef WITHOUT_AUTOFIELD
1556 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1558 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1561 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1562 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1564 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1567 throw INTERP_KERNEL::Exception(msg);
1571 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1576 MCAuto<DataArrayDouble> ret=self->deepCopy();
1577 ret->applyLin(1.,-val);
1578 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1582 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1586 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1587 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1591 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1592 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1595 throw INTERP_KERNEL::Exception(msg);
1599 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1601 const char msg[]="Unexpected situation in __rsub__ !";
1604 DataArrayDoubleTuple *aa;
1605 std::vector<double> bb;
1607 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1612 MCAuto<DataArrayDouble> ret=self->deepCopy();
1613 ret->applyLin(-1.,val);
1618 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1619 return DataArrayDouble::Substract(aaa,self);
1623 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1624 return DataArrayDouble::Substract(aaa,self);
1627 throw INTERP_KERNEL::Exception(msg);
1631 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1633 const char msg[]="Unexpected situation in __isub__ !";
1636 DataArrayDoubleTuple *aa;
1637 std::vector<double> bb;
1639 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1644 self->applyLin(1,-val);
1645 Py_XINCREF(trueSelf);
1650 self->substractEqual(a);
1651 Py_XINCREF(trueSelf);
1656 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1657 self->substractEqual(aaa);
1658 Py_XINCREF(trueSelf);
1663 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1664 self->substractEqual(aaa);
1665 Py_XINCREF(trueSelf);
1669 throw INTERP_KERNEL::Exception(msg);
1673 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1675 const char msg[]="Unexpected situation in __mul__ !";
1678 DataArrayDoubleTuple *aa;
1679 std::vector<double> bb;
1682 #ifndef WITHOUT_AUTOFIELD
1684 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1686 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1689 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1690 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1692 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1695 throw INTERP_KERNEL::Exception(msg);
1699 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1704 MCAuto<DataArrayDouble> ret=self->deepCopy();
1705 ret->applyLin(val,0.);
1706 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1710 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1714 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1715 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1719 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1720 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1723 throw INTERP_KERNEL::Exception(msg);
1727 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1729 const char msg[]="Unexpected situation in __rmul__ !";
1732 DataArrayDoubleTuple *aa;
1733 std::vector<double> bb;
1735 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1740 MCAuto<DataArrayDouble> ret=self->deepCopy();
1741 ret->applyLin(val,0.);
1746 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1747 return DataArrayDouble::Multiply(self,aaa);
1751 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1752 return DataArrayDouble::Multiply(self,aaa);
1755 throw INTERP_KERNEL::Exception(msg);
1759 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1761 return DataArrayT_imul<double>(trueSelf,obj,self);
1764 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1766 const char msg[]="Unexpected situation in __div__ !";
1769 DataArrayDoubleTuple *aa;
1770 std::vector<double> bb;
1773 #ifndef WITHOUT_AUTOFIELD
1775 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1777 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1780 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1781 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1783 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1786 throw INTERP_KERNEL::Exception(msg);
1790 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1796 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1797 MCAuto<DataArrayDouble> ret=self->deepCopy();
1798 ret->applyLin(1/val,0.);
1799 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1803 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1807 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1808 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1812 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1813 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1816 throw INTERP_KERNEL::Exception(msg);
1820 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1822 const char msg[]="Unexpected situation in __rdiv__ !";
1825 DataArrayDoubleTuple *aa;
1826 std::vector<double> bb;
1828 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1833 MCAuto<DataArrayDouble> ret=self->deepCopy();
1839 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1840 return DataArrayDouble::Divide(aaa,self);
1844 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1845 return DataArrayDouble::Divide(aaa,self);
1848 throw INTERP_KERNEL::Exception(msg);
1852 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1854 const char msg[]="Unexpected situation in __idiv__ !";
1857 DataArrayDoubleTuple *aa;
1858 std::vector<double> bb;
1860 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1866 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1867 self->applyLin(1./val,0.);
1868 Py_XINCREF(trueSelf);
1873 self->divideEqual(a);
1874 Py_XINCREF(trueSelf);
1879 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1880 self->divideEqual(aaa);
1881 Py_XINCREF(trueSelf);
1886 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1887 self->divideEqual(aaa);
1888 Py_XINCREF(trueSelf);
1892 throw INTERP_KERNEL::Exception(msg);
1896 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1898 const char msg[]="Unexpected situation in __pow__ !";
1901 DataArrayDoubleTuple *aa;
1902 std::vector<double> bb;
1904 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1909 MCAuto<DataArrayDouble> ret=self->deepCopy();
1915 return DataArrayDouble::Pow(self,a);
1919 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1920 return DataArrayDouble::Pow(self,aaa);
1924 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1925 return DataArrayDouble::Pow(self,aaa);
1928 throw INTERP_KERNEL::Exception(msg);
1932 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1934 const char msg[]="Unexpected situation in __rpow__ !";
1937 DataArrayDoubleTuple *aa;
1938 std::vector<double> bb;
1940 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1945 MCAuto<DataArrayDouble> ret=self->deepCopy();
1946 ret->applyRPow(val);
1951 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1952 return DataArrayDouble::Pow(aaa,self);
1956 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1957 return DataArrayDouble::Pow(aaa,self);
1960 throw INTERP_KERNEL::Exception(msg);
1964 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1966 const char msg[]="Unexpected situation in __ipow__ !";
1969 DataArrayDoubleTuple *aa;
1970 std::vector<double> bb;
1972 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1977 self->applyPow(val);
1978 Py_XINCREF(trueSelf);
1984 Py_XINCREF(trueSelf);
1989 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1990 self->powEqual(aaa);
1991 Py_XINCREF(trueSelf);
1996 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1997 self->powEqual(aaa);
1998 Py_XINCREF(trueSelf);
2002 throw INTERP_KERNEL::Exception(msg);
2006 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2008 DataArrayInt *c=0,*cI=0;
2010 self->computeTupleIdsNearTuples(other,eps,c,cI);
2011 PyObject *ret=PyTuple_New(2);
2012 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2013 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2017 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2019 DataArrayInt *ret1=0;
2020 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2021 PyObject *ret=PyTuple_New(2);
2022 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2023 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2028 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2030 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
2033 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2036 if(!self->isAllocated())
2037 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2038 PyObject *ret(PyTuple_New(1));
2039 PyObject *ret0(PyDict_New());
2040 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2041 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2042 PyObject *tmp1(PyInt_FromLong(0));
2043 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2044 PyTuple_SetItem(ret,0,ret0);
2048 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2054 class DataArrayDoubleTuple;
2056 class DataArrayDoubleIterator
2059 DataArrayDoubleIterator(DataArrayDouble *da);
2060 ~DataArrayDoubleIterator();
2065 DataArrayDoubleTuple *ret=self->nextt();
2067 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2070 PyErr_SetString(PyExc_StopIteration,"No more data.");
2077 class DataArrayDoubleTuple
2080 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2081 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2084 std::string __str__() const throw(INTERP_KERNEL::Exception)
2086 return self->repr();
2089 double __float__() const throw(INTERP_KERNEL::Exception)
2091 return self->doubleValue();
2094 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2096 return self->buildDADouble(1,self->getNumberOfCompo());
2099 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2101 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2102 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2103 Py_XINCREF(trueSelf);
2107 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2109 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2110 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2111 Py_XINCREF(trueSelf);
2115 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2117 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2118 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2119 Py_XINCREF(trueSelf);
2123 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2125 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2126 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2127 Py_XINCREF(trueSelf);
2131 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2133 return PyInt_FromLong(self->getNumberOfCompo());
2136 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2138 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2141 std::vector<int> multiVal;
2142 std::pair<int, std::pair<int,int> > slic;
2143 MEDCoupling::DataArrayInt *daIntTyypp=0;
2144 const double *pt=self->getConstPointer();
2145 int nbc=self->getNumberOfCompo();
2146 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2153 std::ostringstream oss;
2154 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2155 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2159 return PyFloat_FromDouble(pt[singleVal]);
2163 return PyFloat_FromDouble(pt[nbc+singleVal]);
2166 std::ostringstream oss;
2167 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2168 throw INTERP_KERNEL::Exception(oss.str().c_str());
2174 PyObject *t=PyTuple_New(multiVal.size());
2175 for(int j=0;j<(int)multiVal.size();j++)
2177 int cid=multiVal[j];
2180 std::ostringstream oss;
2181 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2182 throw INTERP_KERNEL::Exception(oss.str().c_str());
2184 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2190 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2191 PyObject *t=PyTuple_New(sz);
2192 for(int j=0;j<sz;j++)
2193 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2197 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2201 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2203 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2204 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2207 std::vector<double> multiValV;
2208 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2209 int nbc=self->getNumberOfCompo();
2210 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2212 std::vector<int> multiVal;
2213 std::pair<int, std::pair<int,int> > slic;
2214 MEDCoupling::DataArrayInt *daIntTyypp=0;
2215 double *pt=self->getPointer();
2216 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2223 std::ostringstream oss;
2224 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2225 throw INTERP_KERNEL::Exception(oss.str().c_str());
2231 pt[singleVal]=singleValV;
2236 if(multiValV.size()!=1)
2238 std::ostringstream oss;
2239 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2240 throw INTERP_KERNEL::Exception(oss.str().c_str());
2242 pt[singleVal]=multiValV[0];
2247 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2251 throw INTERP_KERNEL::Exception(msg);
2260 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2264 std::ostringstream oss;
2265 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2266 throw INTERP_KERNEL::Exception(oss.str().c_str());
2274 if(multiVal.size()!=multiValV.size())
2276 std::ostringstream oss;
2277 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2278 throw INTERP_KERNEL::Exception(oss.str().c_str());
2280 for(int i=0;i<(int)multiVal.size();i++)
2282 int pos=multiVal[i];
2285 std::ostringstream oss;
2286 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2287 throw INTERP_KERNEL::Exception(oss.str().c_str());
2289 pt[multiVal[i]]=multiValV[i];
2295 const double *ptV=daIntTyyppV->getConstPointer();
2296 if(nbc>daIntTyyppV->getNumberOfCompo())
2298 std::ostringstream oss;
2299 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2300 throw INTERP_KERNEL::Exception(oss.str().c_str());
2302 std::copy(ptV,ptV+nbc,pt);
2306 throw INTERP_KERNEL::Exception(msg);
2311 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2316 for(int j=0;j<sz;j++)
2317 pt[slic.first+j*slic.second.second]=singleValV;
2322 if(sz!=(int)multiValV.size())
2324 std::ostringstream oss;
2325 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2326 throw INTERP_KERNEL::Exception(oss.str().c_str());
2328 for(int j=0;j<sz;j++)
2329 pt[slic.first+j*slic.second.second]=multiValV[j];
2334 const double *ptV=daIntTyyppV->getConstPointer();
2335 if(sz>daIntTyyppV->getNumberOfCompo())
2337 std::ostringstream oss;
2338 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2339 throw INTERP_KERNEL::Exception(oss.str().c_str());
2341 for(int j=0;j<sz;j++)
2342 pt[slic.first+j*slic.second.second]=ptV[j];
2346 throw INTERP_KERNEL::Exception(msg);
2350 throw INTERP_KERNEL::Exception(msg);
2356 class DataArrayIntIterator;
2358 class DataArrayInt : public DataArray
2361 static DataArrayInt *New();
2362 int intValue() const throw(INTERP_KERNEL::Exception);
2363 int getHashCode() const throw(INTERP_KERNEL::Exception);
2364 bool empty() const throw(INTERP_KERNEL::Exception);
2365 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2366 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2367 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2368 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2369 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2370 int popBackSilent() throw(INTERP_KERNEL::Exception);
2371 void pack() const throw(INTERP_KERNEL::Exception);
2372 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2373 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2374 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2375 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2376 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2377 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2378 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2379 void reverse() throw(INTERP_KERNEL::Exception);
2380 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2381 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2382 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2383 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2384 void fillWithZero() throw(INTERP_KERNEL::Exception);
2385 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2386 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2387 std::string repr() const throw(INTERP_KERNEL::Exception);
2388 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2389 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2390 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2391 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2392 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2393 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2394 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2395 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2396 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2397 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2398 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2399 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2400 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2401 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2402 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2403 void transpose() throw(INTERP_KERNEL::Exception);
2404 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2405 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2406 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2407 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2408 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2409 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2410 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2411 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2412 int front() const throw(INTERP_KERNEL::Exception);
2413 int back() const throw(INTERP_KERNEL::Exception);
2414 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2415 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2416 int *getPointer() throw(INTERP_KERNEL::Exception);
2417 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2418 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2419 const int *begin() const throw(INTERP_KERNEL::Exception);
2420 const int *end() const throw(INTERP_KERNEL::Exception);
2421 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2422 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2423 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2424 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2425 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2426 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2427 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2428 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2429 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2430 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2431 int count(int value) const throw(INTERP_KERNEL::Exception);
2432 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2433 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2434 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2435 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2436 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2437 void abs() throw(INTERP_KERNEL::Exception);
2438 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2439 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2440 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2441 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2442 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2443 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2444 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2445 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2446 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2447 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2448 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2449 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2450 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2451 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2452 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2453 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2454 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2455 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2456 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2457 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2458 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2459 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2460 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2461 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2462 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2463 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2464 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2465 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2466 void computeOffsets() throw(INTERP_KERNEL::Exception);
2467 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2468 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2469 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2470 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2471 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2472 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2473 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2474 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2475 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2476 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2477 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2478 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2479 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2480 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2481 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2482 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2483 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2484 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2485 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2487 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2490 DataArrayInt() throw(INTERP_KERNEL::Exception)
2492 return DataArrayInt::New();
2495 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2497 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)";
2498 std::string msg(msgBase);
2500 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2503 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2507 if(PyInt_Check(nbOfTuples))
2509 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2511 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2514 if(PyInt_Check(nbOfComp))
2515 {//DataArrayInt.New([1,3,4,5],2,2)
2516 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2518 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2519 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2520 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2521 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2525 throw INTERP_KERNEL::Exception(msg.c_str());
2528 {//DataArrayInt.New([1,3,4],3)
2529 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2531 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2532 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2537 throw INTERP_KERNEL::Exception(msg.c_str());
2540 {// DataArrayInt.New([1,3,4])
2541 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2542 int tmpp1=-1,tmpp2=-1;
2543 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2544 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2548 else if(PyInt_Check(elt0))
2550 int nbOfTuples1=PyInt_AS_LONG(elt0);
2552 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2557 if(PyInt_Check(nbOfTuples))
2558 {//DataArrayInt.New(5,2)
2559 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2561 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2562 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2563 ret->alloc(nbOfTuples1,nbOfCompo);
2567 throw INTERP_KERNEL::Exception(msg.c_str());
2570 throw INTERP_KERNEL::Exception(msg.c_str());
2573 {//DataArrayInt.New(5)
2574 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2575 ret->alloc(nbOfTuples1,1);
2580 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2581 {//DataArrayInt.New(numpyArray)
2582 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2586 throw INTERP_KERNEL::Exception(msg.c_str());
2587 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2590 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2592 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2595 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception)
2597 MCAuto<DataArrayDouble> ret(self->convertToDblArr());
2601 DataArrayFloat *convertToFloatArr() const throw(INTERP_KERNEL::Exception)
2603 MCAuto<DataArrayFloat> ret(self->convertToFloatArr());
2607 std::string __str__() const throw(INTERP_KERNEL::Exception)
2609 return self->reprNotTooLong();
2612 int __len__() const throw(INTERP_KERNEL::Exception)
2614 if(self->isAllocated())
2616 return self->getNumberOfTuples();
2620 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2624 int __int__() const throw(INTERP_KERNEL::Exception)
2626 return self->intValue();
2629 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2631 return self->iterator();
2634 DataArrayInt *fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception)
2636 MCAuto<DataArrayInt> ret(self->fromLinkedListOfPairToList());
2640 DataArrayInt *findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
2642 MCAuto<DataArrayInt> ret(self->findIdsGreaterOrEqualTo(val));
2646 DataArrayInt *findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception)
2648 MCAuto<DataArrayInt> ret(self->findIdsGreaterThan(val));
2652 DataArrayInt *findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
2654 MCAuto<DataArrayInt> ret(self->findIdsLowerOrEqualTo(val));
2658 DataArrayInt *findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception)
2660 MCAuto<DataArrayInt> ret(self->findIdsLowerThan(val));
2664 DataArrayInt *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
2666 MCAuto<DataArrayInt> ret(self->selectPartDef(pd));
2670 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2672 int sz=self->getNumberOfComponents();
2673 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2674 self->accumulate(tmp);
2675 return convertIntArrToPyList(tmp,sz);
2678 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2681 std::vector<int> val2;
2682 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2683 return self->accumulatePerChunck(bg,bg+sz);
2686 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2689 std::vector<int> val2;
2690 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2691 return self->findIdsEqualTuple(bg,bg+sz);
2694 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2696 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2697 PyObject *ret=PyList_New(slcs.size());
2698 for(std::size_t i=0;i<slcs.size();i++)
2699 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2703 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2705 if(!PySlice_Check(slic))
2706 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2707 Py_ssize_t strt=2,stp=2,step=2;
2708 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2709 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2710 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2711 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 !");
2712 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2715 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2718 self->getMinMaxValues(a,b);
2719 PyObject *ret=PyTuple_New(2);
2720 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2721 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2725 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2727 int newNbOfTuples=-1;
2728 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2729 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2730 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2731 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2732 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2733 PyObject *ret=PyTuple_New(2);
2734 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2735 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2739 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2741 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2742 int szArr,sw,iTypppArr;
2743 std::vector<int> stdvecTyyppArr;
2744 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2745 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2746 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2750 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2752 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 !";
2753 if(PyList_Check(li) || PyTuple_Check(li))
2755 if(nbOfTuples && nbOfTuples != Py_None)
2757 if(PyInt_Check(nbOfTuples))
2759 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2761 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2762 if(nbOfComp && nbOfComp != Py_None)
2764 if(PyInt_Check(nbOfComp))
2765 {//DataArrayInt.setValues([1,3,4,5],2,2)
2766 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2768 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2769 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2770 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2773 throw INTERP_KERNEL::Exception(msg);
2776 {//DataArrayInt.setValues([1,3,4],3)
2778 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2779 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2783 throw INTERP_KERNEL::Exception(msg);
2786 {// DataArrayInt.setValues([1,3,4])
2787 int tmpp1=-1,tmpp2=-1;
2788 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2789 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2793 throw INTERP_KERNEL::Exception(msg);
2796 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2798 const int *vals=self->getConstPointer();
2799 return convertIntArrToPyList(vals,self->getNbOfElems());
2803 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2805 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2809 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2812 bool ret0=self->isEqualIfNotWhy(other,ret1);
2813 PyObject *ret=PyTuple_New(2);
2814 PyObject *ret0Py=ret0?Py_True:Py_False;
2816 PyTuple_SetItem(ret,0,ret0Py);
2817 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2821 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2823 const int *vals=self->getConstPointer();
2824 int nbOfComp=self->getNumberOfComponents();
2825 int nbOfTuples=self->getNumberOfTuples();
2826 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2829 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2831 std::vector<const DataArrayInt *> groups;
2832 std::vector< std::vector<int> > fidsOfGroups;
2833 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2834 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2835 PyObject *ret = PyList_New(2);
2836 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2837 int sz=fidsOfGroups.size();
2838 PyObject *ret1 = PyList_New(sz);
2839 for(int i=0;i<sz;i++)
2840 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2841 PyList_SetItem(ret,1,ret1);
2845 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2848 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2849 if (!SWIG_IsOK(res1))
2852 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2853 self->transformWithIndArr(tmp,tmp+size);
2857 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2858 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2862 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2866 std::vector<int> multiVal;
2867 std::pair<int, std::pair<int,int> > slic;
2868 MEDCoupling::DataArrayInt *daIntTyypp=0;
2869 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2873 return self->findIdsEqualList(&singleVal,&singleVal+1);
2875 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2877 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2879 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2883 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2887 std::vector<int> multiVal;
2888 std::pair<int, std::pair<int,int> > slic;
2889 MEDCoupling::DataArrayInt *daIntTyypp=0;
2890 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2894 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2896 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2898 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2900 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2904 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2906 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2908 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2909 if (!SWIG_IsOK(res1))
2912 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2913 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2917 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2919 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2920 da2->checkAllocated();
2921 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2923 PyObject *ret = PyList_New(3);
2924 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2925 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2926 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2930 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2933 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2934 if (!SWIG_IsOK(res1))
2937 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2938 return self->transformWithIndArrR(tmp,tmp+size);
2942 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2943 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2947 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2950 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2951 if (!SWIG_IsOK(res1))
2954 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2955 if(size!=self->getNumberOfTuples())
2957 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2959 return self->renumberAndReduce(tmp,newNbOfTuple);
2963 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2965 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2966 da2->checkAllocated();
2967 int size=self->getNumberOfTuples();
2968 if(size!=self->getNumberOfTuples())
2970 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2972 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2976 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2979 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2980 if (!SWIG_IsOK(res1))
2983 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2984 if(size!=self->getNumberOfTuples())
2986 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2988 return self->renumber(tmp);
2992 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2994 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2995 da2->checkAllocated();
2996 int size=self->getNumberOfTuples();
2997 if(size!=self->getNumberOfTuples())
2999 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3001 return self->renumber(da2->getConstPointer());
3005 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3008 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3009 if (!SWIG_IsOK(res1))
3012 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3013 if(size!=self->getNumberOfTuples())
3015 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3017 return self->renumberR(tmp);
3021 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3023 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3024 da2->checkAllocated();
3025 int size=self->getNumberOfTuples();
3026 if(size!=self->getNumberOfTuples())
3028 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3030 return self->renumberR(da2->getConstPointer());
3034 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3036 std::vector<int> tmp;
3037 convertPyToNewIntArr3(li,tmp);
3038 self->setSelectedComponents(a,tmp);
3041 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
3043 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
3044 std::size_t sz(retCpp.size());
3045 PyObject *res(PyList_New(sz));
3046 for(std::size_t i=0;i<sz;i++)
3047 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3051 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3053 int sz=self->getNumberOfComponents();
3054 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3055 self->getTuple(tupleId,tmp);
3056 return convertIntArrToPyList(tmp,sz);
3059 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3061 DataArrayInt *arr=0;
3062 DataArrayInt *arrI=0;
3063 self->changeSurjectiveFormat(targetNb,arr,arrI);
3064 PyObject *res = PyList_New(2);
3065 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3066 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3070 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3072 std::vector<const DataArrayInt *> tmp;
3073 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3074 return DataArrayInt::Meld(tmp);
3077 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3079 std::vector<const DataArrayInt *> tmp;
3080 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3081 return DataArrayInt::Aggregate(tmp);
3084 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3086 std::vector<const DataArrayInt *> tmp;
3087 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3088 return DataArrayInt::AggregateIndexes(tmp);
3091 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3093 std::vector<const DataArrayInt *> tmp;
3094 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3095 return DataArrayInt::BuildUnion(tmp);
3098 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3100 std::vector<const DataArrayInt *> tmp;
3101 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3102 return DataArrayInt::BuildIntersection(tmp);
3105 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3108 int r1=self->getMaxValue(tmp);
3109 PyObject *ret=PyTuple_New(2);
3110 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3111 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3115 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3118 int r1=self->getMinValue(tmp);
3119 PyObject *ret=PyTuple_New(2);
3120 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3121 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3125 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3127 int nbOfCompo=self->getNumberOfComponents();
3132 if(PyInt_Check(obj))
3134 int val=(int)PyInt_AS_LONG(obj);
3135 return self->findIdFirstEqual(val);
3138 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3142 std::vector<int> arr;
3143 convertPyToNewIntArr3(obj,arr);
3144 return self->findIdFirstEqualTuple(arr);
3149 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3151 int nbOfCompo=self->getNumberOfComponents();
3158 if(PyInt_Check(obj))
3160 int val=(int)PyInt_AS_LONG(obj);
3161 return self->presenceOfValue(val);
3164 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3168 std::vector<int> arr;
3169 convertPyToNewIntArr3(obj,arr);
3170 return self->presenceOfTuple(arr);
3175 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3177 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3178 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3179 self->checkAllocated();
3180 int nbOfTuples=self->getNumberOfTuples();
3181 int nbOfComponents=self->getNumberOfComponents();
3183 std::vector<int> vt1,vc1;
3184 std::pair<int, std::pair<int,int> > pt1,pc1;
3185 DataArrayInt *dt1=0,*dc1=0;
3187 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3188 MCAuto<DataArrayInt> ret;
3193 if(nbOfComponents==1)
3194 return PyInt_FromLong(self->getIJSafe(it1,0));
3195 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3198 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3200 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3202 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3204 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3207 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3208 std::vector<int> v2(1,ic1);
3209 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3213 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3214 std::vector<int> v2(1,ic1);
3215 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3219 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3220 std::vector<int> v2(1,ic1);
3221 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3225 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3226 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3230 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3231 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3235 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3236 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3240 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3241 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3245 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3246 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3247 std::vector<int> v2(nbOfComp);
3248 for(int i=0;i<nbOfComp;i++)
3249 v2[i]=pc1.first+i*pc1.second.second;
3250 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3254 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3255 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3256 std::vector<int> v2(nbOfComp);
3257 for(int i=0;i<nbOfComp;i++)
3258 v2[i]=pc1.first+i*pc1.second.second;
3259 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3263 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3264 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3265 std::vector<int> v2(nbOfComp);
3266 for(int i=0;i<nbOfComp;i++)
3267 v2[i]=pc1.first+i*pc1.second.second;
3268 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3272 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3273 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3274 std::vector<int> v2(nbOfComp);
3275 for(int i=0;i<nbOfComp;i++)
3276 v2[i]=pc1.first+i*pc1.second.second;
3277 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3280 throw INTERP_KERNEL::Exception(msg);
3284 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3286 self->checkAllocated();
3287 const char msg[]="Unexpected situation in __setitem__ !";
3288 int nbOfTuples=self->getNumberOfTuples();
3289 int nbOfComponents=self->getNumberOfComponents();
3292 std::vector<int> v1;
3294 DataArrayIntTuple *dd1=0;
3295 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3297 std::vector<int> vt1,vc1;
3298 std::pair<int, std::pair<int,int> > pt1,pc1;
3299 DataArrayInt *dt1=0,*dc1=0;
3300 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3301 MCAuto<DataArrayInt> tmp;
3309 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3312 tmp=DataArrayInt::New();
3313 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3314 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3317 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3320 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3321 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3324 throw INTERP_KERNEL::Exception(msg);
3333 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3336 tmp=DataArrayInt::New();
3337 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3338 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3341 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3344 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3345 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3348 throw INTERP_KERNEL::Exception(msg);
3357 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3360 tmp=DataArrayInt::New();
3361 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3362 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3365 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3368 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3369 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3372 throw INTERP_KERNEL::Exception(msg);
3381 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3384 tmp=DataArrayInt::New();
3385 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3386 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3389 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3392 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3393 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3396 throw INTERP_KERNEL::Exception(msg);
3405 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3408 tmp=DataArrayInt::New();
3409 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3410 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3413 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3416 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3417 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3420 throw INTERP_KERNEL::Exception(msg);
3429 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3432 tmp=DataArrayInt::New();
3433 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3434 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3437 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3440 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3441 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3444 throw INTERP_KERNEL::Exception(msg);
3453 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3456 tmp=DataArrayInt::New();
3457 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3458 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3461 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3464 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3465 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3468 throw INTERP_KERNEL::Exception(msg);
3477 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3480 tmp=DataArrayInt::New();
3481 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3482 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3485 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3488 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3489 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3492 throw INTERP_KERNEL::Exception(msg);
3501 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3504 tmp=DataArrayInt::New();
3505 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3506 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3509 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3512 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3513 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3516 throw INTERP_KERNEL::Exception(msg);
3525 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3528 tmp=DataArrayInt::New();
3529 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3530 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3533 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3536 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3537 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3540 throw INTERP_KERNEL::Exception(msg);
3549 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3552 tmp=DataArrayInt::New();
3553 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3554 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3557 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3560 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3561 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3564 throw INTERP_KERNEL::Exception(msg);
3573 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3576 tmp=DataArrayInt::New();
3577 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3578 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3581 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3584 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3585 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3588 throw INTERP_KERNEL::Exception(msg);
3597 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3600 tmp=DataArrayInt::New();
3601 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3602 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3605 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3608 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3609 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3612 throw INTERP_KERNEL::Exception(msg);
3621 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3624 tmp=DataArrayInt::New();
3625 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3626 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3629 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3632 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3633 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3636 throw INTERP_KERNEL::Exception(msg);
3645 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3648 tmp=DataArrayInt::New();
3649 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3650 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3653 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3656 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3657 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3660 throw INTERP_KERNEL::Exception(msg);
3669 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3672 tmp=DataArrayInt::New();
3673 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3674 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3677 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3680 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3681 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3684 throw INTERP_KERNEL::Exception(msg);
3689 throw INTERP_KERNEL::Exception(msg);
3694 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3696 return self->negate();
3699 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3701 const char msg[]="Unexpected situation in __add__ !";
3704 std::vector<int> aa;
3705 DataArrayIntTuple *aaa;
3707 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3712 MCAuto<DataArrayInt> ret=self->deepCopy();
3713 ret->applyLin(1,val);
3718 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3719 return DataArrayInt::Add(self,aaaa);
3723 return DataArrayInt::Add(self,a);
3727 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3728 return DataArrayInt::Add(self,aaaa);
3731 throw INTERP_KERNEL::Exception(msg);
3735 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3737 const char msg[]="Unexpected situation in __radd__ !";
3740 std::vector<int> aa;
3741 DataArrayIntTuple *aaa;
3743 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3748 MCAuto<DataArrayInt> ret=self->deepCopy();
3749 ret->applyLin(1,val);
3754 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3755 return DataArrayInt::Add(self,aaaa);
3759 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3760 return DataArrayInt::Add(self,aaaa);
3763 throw INTERP_KERNEL::Exception(msg);
3767 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3769 const char msg[]="Unexpected situation in __iadd__ !";
3772 std::vector<int> aa;
3773 DataArrayIntTuple *aaa;
3775 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3780 self->applyLin(1,val);
3781 Py_XINCREF(trueSelf);
3786 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3788 Py_XINCREF(trueSelf);
3794 Py_XINCREF(trueSelf);
3799 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3800 self->addEqual(aaaa);
3801 Py_XINCREF(trueSelf);
3805 throw INTERP_KERNEL::Exception(msg);
3809 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3811 const char msg[]="Unexpected situation in __sub__ !";
3814 std::vector<int> aa;
3815 DataArrayIntTuple *aaa;
3817 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3822 MCAuto<DataArrayInt> ret=self->deepCopy();
3823 ret->applyLin(1,-val);
3828 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3829 return DataArrayInt::Substract(self,aaaa);
3833 return DataArrayInt::Substract(self,a);
3837 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3838 return DataArrayInt::Substract(self,aaaa);
3841 throw INTERP_KERNEL::Exception(msg);
3845 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3847 const char msg[]="Unexpected situation in __rsub__ !";
3850 std::vector<int> aa;
3851 DataArrayIntTuple *aaa;
3853 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3858 MCAuto<DataArrayInt> ret=self->deepCopy();
3859 ret->applyLin(-1,val);
3864 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3865 return DataArrayInt::Substract(aaaa,self);
3869 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3870 return DataArrayInt::Substract(aaaa,self);
3873 throw INTERP_KERNEL::Exception(msg);
3877 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3879 const char msg[]="Unexpected situation in __isub__ !";
3882 std::vector<int> aa;
3883 DataArrayIntTuple *aaa;
3885 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3890 self->applyLin(1,-val);
3891 Py_XINCREF(trueSelf);
3896 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3897 self->substractEqual(bb);
3898 Py_XINCREF(trueSelf);
3903 self->substractEqual(a);
3904 Py_XINCREF(trueSelf);
3909 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3910 self->substractEqual(aaaa);
3911 Py_XINCREF(trueSelf);
3915 throw INTERP_KERNEL::Exception(msg);
3919 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3921 const char msg[]="Unexpected situation in __mul__ !";
3924 std::vector<int> aa;
3925 DataArrayIntTuple *aaa;
3927 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3932 MCAuto<DataArrayInt> ret=self->deepCopy();
3933 ret->applyLin(val,0);
3938 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3939 return DataArrayInt::Multiply(self,aaaa);
3943 return DataArrayInt::Multiply(self,a);
3947 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3948 return DataArrayInt::Multiply(self,aaaa);
3951 throw INTERP_KERNEL::Exception(msg);
3955 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3957 const char msg[]="Unexpected situation in __rmul__ !";
3960 std::vector<int> aa;
3961 DataArrayIntTuple *aaa;
3963 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3968 MCAuto<DataArrayInt> ret=self->deepCopy();
3969 ret->applyLin(val,0);
3974 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3975 return DataArrayInt::Multiply(self,aaaa);
3979 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3980 return DataArrayInt::Multiply(self,aaaa);
3983 throw INTERP_KERNEL::Exception(msg);
3987 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3989 const char msg[]="Unexpected situation in __imul__ !";
3992 std::vector<int> aa;
3993 DataArrayIntTuple *aaa;
3995 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4000 self->applyLin(val,0);
4001 Py_XINCREF(trueSelf);
4006 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4007 self->multiplyEqual(bb);
4008 Py_XINCREF(trueSelf);
4013 self->multiplyEqual(a);
4014 Py_XINCREF(trueSelf);
4019 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4020 self->multiplyEqual(aaaa);
4021 Py_XINCREF(trueSelf);
4025 throw INTERP_KERNEL::Exception(msg);
4029 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4031 const char msg[]="Unexpected situation in __div__ !";
4034 std::vector<int> aa;
4035 DataArrayIntTuple *aaa;
4037 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4042 MCAuto<DataArrayInt> ret=self->deepCopy();
4043 ret->applyDivideBy(val);
4048 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4049 return DataArrayInt::Divide(self,aaaa);
4053 return DataArrayInt::Divide(self,a);
4057 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4058 return DataArrayInt::Divide(self,aaaa);
4061 throw INTERP_KERNEL::Exception(msg);
4065 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4067 const char msg[]="Unexpected situation in __rdiv__ !";
4070 std::vector<int> aa;
4071 DataArrayIntTuple *aaa;
4073 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4078 MCAuto<DataArrayInt> ret=self->deepCopy();
4084 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4085 return DataArrayInt::Divide(aaaa,self);
4089 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4090 return DataArrayInt::Divide(aaaa,self);
4093 throw INTERP_KERNEL::Exception(msg);
4097 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4099 const char msg[]="Unexpected situation in __idiv__ !";
4102 std::vector<int> aa;
4103 DataArrayIntTuple *aaa;
4105 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4110 self->applyDivideBy(val);
4111 Py_XINCREF(trueSelf);
4116 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4117 self->divideEqual(bb);
4118 Py_XINCREF(trueSelf);
4123 self->divideEqual(a);
4124 Py_XINCREF(trueSelf);
4129 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4130 self->divideEqual(aaaa);
4131 Py_XINCREF(trueSelf);
4135 throw INTERP_KERNEL::Exception(msg);
4139 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4141 const char msg[]="Unexpected situation in __mod__ !";
4144 std::vector<int> aa;
4145 DataArrayIntTuple *aaa;
4147 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4152 MCAuto<DataArrayInt> ret=self->deepCopy();
4153 ret->applyModulus(val);
4158 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4159 return DataArrayInt::Modulus(self,aaaa);
4163 return DataArrayInt::Modulus(self,a);
4167 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4168 return DataArrayInt::Modulus(self,aaaa);
4171 throw INTERP_KERNEL::Exception(msg);
4175 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4177 const char msg[]="Unexpected situation in __rmod__ !";
4180 std::vector<int> aa;
4181 DataArrayIntTuple *aaa;
4183 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4188 MCAuto<DataArrayInt> ret=self->deepCopy();
4189 ret->applyRModulus(val);
4194 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4195 return DataArrayInt::Modulus(aaaa,self);
4199 return DataArrayInt::Modulus(a,self);
4203 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4204 return DataArrayInt::Modulus(aaaa,self);
4207 throw INTERP_KERNEL::Exception(msg);
4211 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4213 const char msg[]="Unexpected situation in __imod__ !";
4216 std::vector<int> aa;
4217 DataArrayIntTuple *aaa;
4219 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4224 self->applyModulus(val);
4225 Py_XINCREF(trueSelf);
4230 self->modulusEqual(a);
4231 Py_XINCREF(trueSelf);
4236 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4237 self->modulusEqual(aaaa);
4238 Py_XINCREF(trueSelf);
4242 throw INTERP_KERNEL::Exception(msg);
4246 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4248 const char msg[]="Unexpected situation in __pow__ !";
4251 std::vector<int> aa;
4252 DataArrayIntTuple *aaa;
4254 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4259 MCAuto<DataArrayInt> ret=self->deepCopy();
4265 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4266 return DataArrayInt::Pow(self,aaaa);
4270 return DataArrayInt::Pow(self,a);
4274 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4275 return DataArrayInt::Pow(self,aaaa);
4278 throw INTERP_KERNEL::Exception(msg);
4282 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4284 const char msg[]="Unexpected situation in __rpow__ !";
4287 std::vector<int> aa;
4288 DataArrayIntTuple *aaa;
4290 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4295 MCAuto<DataArrayInt> ret=self->deepCopy();
4296 ret->applyRPow(val);
4301 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4302 return DataArrayInt::Pow(aaaa,self);
4306 return DataArrayInt::Pow(a,self);
4310 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4311 return DataArrayInt::Pow(aaaa,self);
4314 throw INTERP_KERNEL::Exception(msg);
4318 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4320 const char msg[]="Unexpected situation in __ipow__ !";
4323 std::vector<int> aa;
4324 DataArrayIntTuple *aaa;
4326 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4331 self->applyPow(val);
4332 Py_XINCREF(trueSelf);
4338 Py_XINCREF(trueSelf);
4343 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4344 self->powEqual(aaaa);
4345 Py_XINCREF(trueSelf);
4349 throw INTERP_KERNEL::Exception(msg);
4353 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4355 std::ostringstream oss;
4356 self->reprQuickOverview(oss);
4360 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4362 int szArr,sw,iTypppArr;
4363 std::vector<int> stdvecTyyppArr;
4364 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4365 self->pushBackValsSilent(tmp,tmp+szArr);
4368 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4370 std::vector<int> ret1;
4371 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4372 std::size_t sz=ret0.size();
4373 PyObject *pyRet=PyTuple_New(2);
4374 PyObject *pyRet0=PyList_New((int)sz);
4375 PyObject *pyRet1=PyList_New((int)sz);
4376 for(std::size_t i=0;i<sz;i++)
4378 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4379 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4381 PyTuple_SetItem(pyRet,0,pyRet0);
4382 PyTuple_SetItem(pyRet,1,pyRet1);
4386 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4388 DataArrayInt *ret0=0,*ret1=0;
4389 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4390 PyObject *pyRet=PyTuple_New(2);
4391 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4392 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4396 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4399 bool ret(self->isRange(a,b,c));
4400 PyObject *pyRet=PyTuple_New(2);
4401 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4403 PyTuple_SetItem(pyRet,0,ret0Py);
4405 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4411 PyTuple_SetItem(pyRet,1,ret1Py);
4416 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4418 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4421 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4424 if(!self->isAllocated())
4425 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4426 PyObject *ret(PyTuple_New(1));
4427 PyObject *ret0(PyDict_New());
4428 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4429 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4430 PyObject *tmp1(PyInt_FromLong(0));
4431 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4432 PyTuple_SetItem(ret,0,ret0);
4436 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4442 class DataArrayIntTuple;
4444 class DataArrayIntIterator
4447 DataArrayIntIterator(DataArrayInt *da);
4448 ~DataArrayIntIterator();
4453 DataArrayIntTuple *ret=self->nextt();
4455 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4458 PyErr_SetString(PyExc_StopIteration,"No more data.");
4465 class DataArrayIntTuple
4468 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4469 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4472 std::string __str__() const throw(INTERP_KERNEL::Exception)
4474 return self->repr();
4477 int __int__() const throw(INTERP_KERNEL::Exception)
4479 return self->intValue();
4482 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4484 return self->buildDAInt(1,self->getNumberOfCompo());
4487 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4489 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4490 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4491 Py_XINCREF(trueSelf);
4495 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4497 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4498 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4499 Py_XINCREF(trueSelf);
4503 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4505 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4506 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4507 Py_XINCREF(trueSelf);
4511 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4513 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4514 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4515 Py_XINCREF(trueSelf);
4519 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4521 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4522 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4523 Py_XINCREF(trueSelf);
4527 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4529 return PyInt_FromLong(self->getNumberOfCompo());
4532 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4534 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4537 std::vector<int> multiVal;
4538 std::pair<int, std::pair<int,int> > slic;
4539 MEDCoupling::DataArrayInt *daIntTyypp=0;
4540 const int *pt=self->getConstPointer();
4541 int nbc=self->getNumberOfCompo();
4542 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4549 std::ostringstream oss;
4550 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4551 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4555 return PyInt_FromLong(pt[singleVal]);
4559 return PyInt_FromLong(pt[nbc+singleVal]);
4562 std::ostringstream oss;
4563 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4564 throw INTERP_KERNEL::Exception(oss.str().c_str());
4570 PyObject *t=PyTuple_New(multiVal.size());
4571 for(int j=0;j<(int)multiVal.size();j++)
4573 int cid=multiVal[j];
4576 std::ostringstream oss;
4577 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4578 throw INTERP_KERNEL::Exception(oss.str().c_str());
4580 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4586 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4587 PyObject *t=PyTuple_New(sz);
4588 for(int j=0;j<sz;j++)
4589 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4593 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4597 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4599 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4600 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4603 std::vector<int> multiValV;
4604 std::pair<int, std::pair<int,int> > slicV;
4605 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4606 int nbc=self->getNumberOfCompo();
4607 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4609 std::vector<int> multiVal;
4610 std::pair<int, std::pair<int,int> > slic;
4611 MEDCoupling::DataArrayInt *daIntTyypp=0;
4612 int *pt=self->getPointer();
4613 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4620 std::ostringstream oss;
4621 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4622 throw INTERP_KERNEL::Exception(oss.str().c_str());
4628 pt[singleVal]=singleValV;
4633 if(multiValV.size()!=1)
4635 std::ostringstream oss;
4636 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4637 throw INTERP_KERNEL::Exception(oss.str().c_str());
4639 pt[singleVal]=multiValV[0];
4644 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4648 throw INTERP_KERNEL::Exception(msg);
4657 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4661 std::ostringstream oss;
4662 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4663 throw INTERP_KERNEL::Exception(oss.str().c_str());
4671 if(multiVal.size()!=multiValV.size())
4673 std::ostringstream oss;
4674 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4675 throw INTERP_KERNEL::Exception(oss.str().c_str());
4677 for(int i=0;i<(int)multiVal.size();i++)
4679 int pos=multiVal[i];
4682 std::ostringstream oss;
4683 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4684 throw INTERP_KERNEL::Exception(oss.str().c_str());
4686 pt[multiVal[i]]=multiValV[i];
4692 const int *ptV=daIntTyyppV->getConstPointer();
4693 if(nbc>daIntTyyppV->getNumberOfCompo())
4695 std::ostringstream oss;
4696 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4697 throw INTERP_KERNEL::Exception(oss.str().c_str());
4699 std::copy(ptV,ptV+nbc,pt);
4703 throw INTERP_KERNEL::Exception(msg);
4708 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4713 for(int j=0;j<sz;j++)
4714 pt[slic.first+j*slic.second.second]=singleValV;
4719 if(sz!=(int)multiValV.size())
4721 std::ostringstream oss;
4722 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4723 throw INTERP_KERNEL::Exception(oss.str().c_str());
4725 for(int j=0;j<sz;j++)
4726 pt[slic.first+j*slic.second.second]=multiValV[j];
4731 const int *ptV=daIntTyyppV->getConstPointer();
4732 if(sz>daIntTyyppV->getNumberOfCompo())
4734 std::ostringstream oss;
4735 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4736 throw INTERP_KERNEL::Exception(oss.str().c_str());
4738 for(int j=0;j<sz;j++)
4739 pt[slic.first+j*slic.second.second]=ptV[j];
4743 throw INTERP_KERNEL::Exception(msg);
4747 throw INTERP_KERNEL::Exception(msg);
4753 class DataArrayChar : public DataArray
4756 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4757 int getHashCode() const throw(INTERP_KERNEL::Exception);
4758 bool empty() const throw(INTERP_KERNEL::Exception);
4759 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4760 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4761 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4762 char popBackSilent() throw(INTERP_KERNEL::Exception);
4763 void pack() const throw(INTERP_KERNEL::Exception);
4764 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4765 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4766 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4767 void reverse() throw(INTERP_KERNEL::Exception);
4768 void fillWithZero() throw(INTERP_KERNEL::Exception);
4769 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4770 std::string repr() const throw(INTERP_KERNEL::Exception);
4771 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4772 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4773 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4774 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4775 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4776 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4777 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4778 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4779 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4780 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4781 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4782 char front() const throw(INTERP_KERNEL::Exception);
4783 char back() const throw(INTERP_KERNEL::Exception);
4784 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4785 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4786 char *getPointer() throw(INTERP_KERNEL::Exception);
4787 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4788 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4789 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4790 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4791 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4792 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4793 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4794 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4795 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4796 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4797 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4800 int __len__() const throw(INTERP_KERNEL::Exception)
4802 if(self->isAllocated())
4804 return self->getNumberOfTuples();
4808 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4812 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4815 bool ret0=self->isEqualIfNotWhy(other,ret1);
4816 PyObject *ret=PyTuple_New(2);
4817 PyObject *ret0Py=ret0?Py_True:Py_False;
4819 PyTuple_SetItem(ret,0,ret0Py);
4820 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4824 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4827 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4828 if (!SWIG_IsOK(res1))
4831 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4832 if(size!=self->getNumberOfTuples())
4834 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4836 return self->renumber(tmp);
4840 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4842 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4843 da2->checkAllocated();
4844 int size=self->getNumberOfTuples();
4845 if(size!=self->getNumberOfTuples())
4847 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4849 return self->renumber(da2->getConstPointer());
4853 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4856 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4857 if (!SWIG_IsOK(res1))
4860 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4861 if(size!=self->getNumberOfTuples())
4863 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4865 return self->renumberR(tmp);
4869 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4871 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4872 da2->checkAllocated();
4873 int size=self->getNumberOfTuples();
4874 if(size!=self->getNumberOfTuples())
4876 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4878 return self->renumberR(da2->getConstPointer());
4882 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4885 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4886 if (!SWIG_IsOK(res1))
4889 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4890 if(size!=self->getNumberOfTuples())
4892 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4894 return self->renumberAndReduce(tmp,newNbOfTuple);
4898 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4900 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4901 da2->checkAllocated();
4902 int size=self->getNumberOfTuples();
4903 if(size!=self->getNumberOfTuples())
4905 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4907 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4911 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4913 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4914 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4915 return DataArrayChar::Aggregate(tmp);
4918 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4920 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4921 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4922 return DataArrayChar::Meld(tmp);
4927 class DataArrayByteIterator;
4929 class DataArrayByte : public DataArrayChar
4932 static DataArrayByte *New();
4933 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4934 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4935 char byteValue() const throw(INTERP_KERNEL::Exception);
4938 DataArrayByte() throw(INTERP_KERNEL::Exception)
4940 return DataArrayByte::New();
4943 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4945 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) !";
4946 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4950 if(PyInt_Check(nbOfTuples))
4952 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4954 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4957 if(PyInt_Check(nbOfComp))
4958 {//DataArrayByte.New([1,3,4,5],2,2)
4959 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4961 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4962 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4963 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4964 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4968 throw INTERP_KERNEL::Exception(msg);
4971 {//DataArrayByte.New([1,3,4],3)
4972 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4974 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4975 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4980 throw INTERP_KERNEL::Exception(msg);
4983 {// DataArrayByte.New([1,3,4])
4984 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4985 int tmpp1=-1,tmpp2=-1;
4986 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4987 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4991 else if(PyInt_Check(elt0))
4993 int nbOfTuples1=PyInt_AS_LONG(elt0);
4995 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5000 if(PyInt_Check(nbOfTuples))
5001 {//DataArrayByte.New(5,2)
5002 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5004 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5005 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5006 ret->alloc(nbOfTuples1,nbOfCompo);
5010 throw INTERP_KERNEL::Exception(msg);
5013 throw INTERP_KERNEL::Exception(msg);
5016 {//DataArrayByte.New(5)
5017 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5018 ret->alloc(nbOfTuples1,1);
5023 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
5024 {//DataArrayDouble.New(numpyArray)
5025 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
5029 throw INTERP_KERNEL::Exception(msg);
5032 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5034 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5037 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5039 std::ostringstream oss;
5040 self->reprQuickOverview(oss);
5044 int __int__() const throw(INTERP_KERNEL::Exception)
5046 return (int) self->byteValue();
5049 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5051 return self->iterator();
5054 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5056 return (int)self->getIJ(tupleId,compoId);
5059 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5061 return (int)self->getIJSafe(tupleId,compoId);
5064 std::string __str__() const throw(INTERP_KERNEL::Exception)
5066 return self->repr();
5069 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5071 const char *vals=self->getConstPointer();
5072 int nbOfComp=self->getNumberOfComponents();
5073 int nbOfTuples=self->getNumberOfTuples();
5074 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5077 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5080 int ival=-1; std::vector<int> ivval;
5081 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
5082 std::vector<char> vals(sz);
5083 std::copy(pt,pt+sz,vals.begin());
5084 return self->presenceOfTuple(vals);
5087 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5090 int ival=-1; std::vector<int> ivval;
5091 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
5092 std::vector<char> vals2(sz);
5093 std::copy(pt,pt+sz,vals2.begin());
5094 return self->presenceOfValue(vals2);
5097 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5100 int ival=-1; std::vector<int> ivval;
5101 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
5102 std::vector<char> vals2(sz);
5103 std::copy(pt,pt+sz,vals2.begin());
5104 return self->findIdFirstEqual(vals2);
5107 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5110 int ival=-1; std::vector<int> ivval;
5111 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
5112 std::vector<char> vals(sz);
5113 std::copy(pt,pt+sz,vals.begin());
5114 return self->findIdFirstEqualTuple(vals);
5117 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5120 int ival=-1; std::vector<int> ivval;
5121 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
5122 std::vector<char> vals(sz);
5123 std::copy(pt,pt+sz,vals.begin());
5124 return self->findIdSequence(vals);
5127 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5129 int sz=self->getNumberOfComponents();
5130 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5131 self->getTuple(tupleId,tmp);
5132 PyObject *ret=PyTuple_New(sz);
5133 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5137 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5140 int r1=(int)self->getMaxValue(tmp);
5141 PyObject *ret=PyTuple_New(2);
5142 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5143 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5147 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5150 int r1=(int)self->getMinValue(tmp);
5151 PyObject *ret=PyTuple_New(2);
5152 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5153 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5157 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5159 int nbOfCompo=self->getNumberOfComponents();
5164 if(PyInt_Check(obj))
5166 int val=(int)PyInt_AS_LONG(obj);
5167 return self->findIdFirstEqual(val);
5170 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5173 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5177 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5179 int nbOfCompo=self->getNumberOfComponents();
5186 if(PyInt_Check(obj))
5188 int val=(int)PyInt_AS_LONG(obj);
5189 return self->presenceOfValue(val);
5192 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5195 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5200 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5202 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5207 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5209 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5212 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5215 if(!self->isAllocated())
5216 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5217 PyObject *ret(PyTuple_New(1));
5218 PyObject *ret0(PyDict_New());
5219 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5220 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5221 PyObject *tmp1(PyInt_FromLong(0));
5222 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5223 PyTuple_SetItem(ret,0,ret0);
5227 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5231 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5233 self->checkAllocated();
5234 const char msg[]="Unexpected situation in __setitem__ !";
5235 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5238 std::vector<int> v1;
5240 DataArrayIntTuple *dd1=0;
5241 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5243 std::vector<int> vt1,vc1;
5244 std::pair<int, std::pair<int,int> > pt1,pc1;
5245 DataArrayInt *dt1=0,*dc1=0;
5246 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5247 MCAuto<DataArrayInt> tmp;
5255 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5258 throw INTERP_KERNEL::Exception(msg);
5267 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5270 throw INTERP_KERNEL::Exception(msg);
5279 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5282 throw INTERP_KERNEL::Exception(msg);
5291 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5294 throw INTERP_KERNEL::Exception(msg);
5303 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5306 throw INTERP_KERNEL::Exception(msg);
5315 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5318 throw INTERP_KERNEL::Exception(msg);
5327 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5330 throw INTERP_KERNEL::Exception(msg);
5339 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5342 throw INTERP_KERNEL::Exception(msg);
5351 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5354 throw INTERP_KERNEL::Exception(msg);
5363 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5366 throw INTERP_KERNEL::Exception(msg);
5375 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5378 throw INTERP_KERNEL::Exception(msg);
5387 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5390 throw INTERP_KERNEL::Exception(msg);
5399 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5402 throw INTERP_KERNEL::Exception(msg);
5411 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5414 throw INTERP_KERNEL::Exception(msg);
5423 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5426 throw INTERP_KERNEL::Exception(msg);
5435 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5438 throw INTERP_KERNEL::Exception(msg);
5443 throw INTERP_KERNEL::Exception(msg);
5450 class DataArrayByteTuple;
5452 class DataArrayByteIterator
5455 DataArrayByteIterator(DataArrayByte *da);
5456 ~DataArrayByteIterator();
5459 class DataArrayByteTuple
5462 std::string repr() const throw(INTERP_KERNEL::Exception);
5463 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5466 std::string __str__() const throw(INTERP_KERNEL::Exception)
5468 return self->repr();
5471 char __int__() const throw(INTERP_KERNEL::Exception)
5473 return self->byteValue();
5476 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5478 return self->buildDAByte(1,self->getNumberOfCompo());
5483 class DataArrayAsciiCharIterator;
5485 class DataArrayAsciiChar : public DataArrayChar
5488 static DataArrayAsciiChar *New();
5489 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5490 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5491 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5494 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5496 return DataArrayAsciiChar::New();
5499 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5501 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) !";
5502 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5506 if(PyInt_Check(nbOfTuples))
5508 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5510 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5513 if(PyInt_Check(nbOfComp))
5514 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5515 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5517 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5518 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5519 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5520 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5524 throw INTERP_KERNEL::Exception(msg);
5527 {//DataArrayAsciiChar.New([1,3,4],3)
5528 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5530 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5531 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5535 else if(PyString_Check(nbOfTuples))
5537 if(PyString_Size(nbOfTuples)!=1)
5538 throw INTERP_KERNEL::Exception(msg);
5539 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5540 std::vector<std::string> tmp;
5541 if(fillStringVector(elt0,tmp))
5542 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5544 throw INTERP_KERNEL::Exception(msg);
5547 throw INTERP_KERNEL::Exception(msg);
5551 std::vector<std::string> tmmp;
5552 if(fillStringVector(elt0,tmmp))
5553 //DataArrayAsciiChar.New(["abc","de","fghi"])
5554 return DataArrayAsciiChar::New(tmmp,' ');
5557 // DataArrayAsciiChar.New([1,3,4])
5558 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5559 int tmpp1=-1,tmpp2=-1;
5560 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5561 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5566 else if(PyInt_Check(elt0))
5568 int nbOfTuples1=PyInt_AS_LONG(elt0);
5570 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5575 if(PyInt_Check(nbOfTuples))
5576 {//DataArrayAsciiChar.New(5,2)
5577 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5579 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5580 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5581 ret->alloc(nbOfTuples1,nbOfCompo);
5585 throw INTERP_KERNEL::Exception(msg);
5588 throw INTERP_KERNEL::Exception(msg);
5591 {//DataArrayAsciiChar.New(5)
5592 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5593 ret->alloc(nbOfTuples1,1);
5598 throw INTERP_KERNEL::Exception(msg);
5601 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5603 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5606 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5608 std::ostringstream oss;
5609 self->reprQuickOverview(oss);
5613 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5615 return self->iterator();
5618 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5620 char tmp[2]; tmp[1]='\0';
5621 tmp[0]=self->getIJ(tupleId,compoId);
5622 return std::string(tmp);
5625 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5627 char tmp[2]; tmp[1]='\0';
5628 tmp[0]=self->getIJSafe(tupleId,compoId);
5629 return std::string(tmp);
5632 std::string __str__() const throw(INTERP_KERNEL::Exception)
5634 return self->repr();
5637 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5639 const char *vals=self->getConstPointer();
5640 int nbOfComp=self->getNumberOfComponents();
5641 int nbOfTuples=self->getNumberOfTuples();
5642 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5645 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5647 if(PyString_Check(tupl))
5649 Py_ssize_t sz=PyString_Size(tupl);
5650 std::vector<char> vals(sz);
5651 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5652 return self->presenceOfTuple(vals);
5655 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5658 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5660 if(PyString_Check(vals))
5662 Py_ssize_t sz=PyString_Size(vals);
5663 std::vector<char> vals2(sz);
5664 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5665 return self->presenceOfValue(vals2);
5668 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5671 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5673 if(PyString_Check(vals))
5675 Py_ssize_t sz=PyString_Size(vals);
5676 std::vector<char> vals2(sz);
5677 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5678 return self->findIdFirstEqual(vals2);
5681 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5684 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5686 if(PyString_Check(tupl))
5688 Py_ssize_t sz=PyString_Size(tupl);
5689 std::vector<char> vals(sz);
5690 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5691 return self->findIdFirstEqualTuple(vals);
5694 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5697 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5699 if(PyString_Check(strOrListOfInt))
5701 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5702 std::vector<char> vals(sz);
5703 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5704 return self->findIdSequence(vals);
5707 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5710 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5712 int sz=self->getNumberOfComponents();
5713 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5714 self->getTuple(tupleId,tmp);
5715 return PyString_FromString(tmp);
5718 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5721 char tmp2[2]; tmp2[1]='\0';
5722 tmp2[0]=self->getMaxValue(tmp);
5723 PyObject *ret=PyTuple_New(2);
5724 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5725 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5729 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5732 char tmp2[2]; tmp2[1]='\0';
5733 tmp2[0]=self->getMinValue(tmp);
5734 PyObject *ret=PyTuple_New(2);
5735 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5736 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5740 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5742 int nbOfCompo=self->getNumberOfComponents();
5747 if(PyString_Check(obj))
5749 Py_ssize_t sz=PyString_Size(obj);
5750 char *pt=PyString_AsString(obj);
5752 return self->findIdFirstEqual(pt[0]);
5754 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5757 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5760 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5764 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5766 int nbOfCompo=self->getNumberOfComponents();
5773 if(PyString_Check(obj))
5775 Py_ssize_t sz=PyString_Size(obj);
5776 char *pt=PyString_AsString(obj);
5778 return self->presenceOfValue(pt[0]);
5780 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5783 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5786 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5790 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5793 std::vector<int> stdvecTyyppArr;
5794 std::pair<int, std::pair<int,int> > sTyyppArr;
5795 MEDCoupling::DataArrayInt *daIntTyypp=0;
5796 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5800 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5802 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5804 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5806 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5808 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5812 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5814 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.";
5816 std::vector<int> stdvecTyyppArr;
5817 std::pair<int, std::pair<int,int> > sTyyppArr;
5818 MEDCoupling::DataArrayInt *daIntTyypp=0;
5819 int nbOfCompo=self->getNumberOfComponents();
5820 int nbOfTuples=self->getNumberOfTuples();
5821 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5823 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5824 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5833 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5839 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5840 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5843 //value vector<string>
5846 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5847 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5850 //value DataArrayChar
5853 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5857 throw INTERP_KERNEL::Exception(msg);
5861 {//obj list-tuple[int]
5867 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5873 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5874 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5877 //value vector<string>
5880 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5881 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5884 //value DataArrayChar
5887 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5891 throw INTERP_KERNEL::Exception(msg);
5902 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5908 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5909 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5912 //value vector<string>
5915 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5916 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5919 //value DataArrayChar
5922 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5926 throw INTERP_KERNEL::Exception(msg);
5937 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5943 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5944 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5947 //value vector<string>
5950 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5951 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5954 //value DataArrayChar
5957 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5961 throw INTERP_KERNEL::Exception(msg);
5966 throw INTERP_KERNEL::Exception(msg);
5972 class DataArrayAsciiCharTuple;
5974 class DataArrayAsciiCharIterator
5977 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5978 ~DataArrayAsciiCharIterator();
5983 DataArrayAsciiCharTuple *ret=self->nextt();
5985 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5988 PyErr_SetString(PyExc_StopIteration,"No more data.");
5995 class DataArrayAsciiCharTuple
5998 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5999 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6002 std::string __str__() const throw(INTERP_KERNEL::Exception)
6004 return self->repr();
6007 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6009 return self->buildDAAsciiChar(1,self->getNumberOfCompo());