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::DataArrayFloat::convertToDblArr;
56 %newobject MEDCoupling::DataArrayInt::New;
57 %newobject MEDCoupling::DataArrayInt::__iter__;
58 %newobject MEDCoupling::DataArrayInt::selectPartDef;
59 %newobject MEDCoupling::DataArrayInt::convertToDblArr;
60 %newobject MEDCoupling::DataArrayInt::convertToFloatArr;
61 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
62 %newobject MEDCoupling::DataArrayInt::subArray;
63 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
64 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
65 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
66 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
67 %newobject MEDCoupling::DataArrayInt::renumber;
68 %newobject MEDCoupling::DataArrayInt::renumberR;
69 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
70 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
71 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
72 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
73 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
74 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
75 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
76 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
77 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
78 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
79 %newobject MEDCoupling::DataArrayInt::negate;
80 %newobject MEDCoupling::DataArrayInt::computeAbs;
81 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
82 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
83 %newobject MEDCoupling::DataArrayInt::findIdsStricltyNegative;
84 %newobject MEDCoupling::DataArrayInt::Aggregate;
85 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
86 %newobject MEDCoupling::DataArrayInt::Meld;
87 %newobject MEDCoupling::DataArrayInt::Add;
88 %newobject MEDCoupling::DataArrayInt::Substract;
89 %newobject MEDCoupling::DataArrayInt::Multiply;
90 %newobject MEDCoupling::DataArrayInt::Divide;
91 %newobject MEDCoupling::DataArrayInt::Pow;
92 %newobject MEDCoupling::DataArrayInt::BuildUnion;
93 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
94 %newobject MEDCoupling::DataArrayInt::Range;
95 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
96 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
97 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
98 %newobject MEDCoupling::DataArrayInt::buildComplement;
99 %newobject MEDCoupling::DataArrayInt::buildUnion;
100 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
101 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
102 %newobject MEDCoupling::DataArrayInt::buildIntersection;
103 %newobject MEDCoupling::DataArrayInt::buildUnique;
104 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
105 %newobject MEDCoupling::DataArrayInt::fromLinkedListOfPairToList;
106 %newobject MEDCoupling::DataArrayInt::findIdsGreaterOrEqualTo;
107 %newobject MEDCoupling::DataArrayInt::findIdsGreaterThan;
108 %newobject MEDCoupling::DataArrayInt::findIdsLowerOrEqualTo;
109 %newobject MEDCoupling::DataArrayInt::findIdsLowerThan;
110 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
111 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
112 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
113 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
114 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
115 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
116 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
117 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
118 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
119 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
120 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
121 %newobject MEDCoupling::DataArrayInt::__neg__;
122 %newobject MEDCoupling::DataArrayInt::__add__;
123 %newobject MEDCoupling::DataArrayInt::__radd__;
124 %newobject MEDCoupling::DataArrayInt::__sub__;
125 %newobject MEDCoupling::DataArrayInt::__rsub__;
126 %newobject MEDCoupling::DataArrayInt::__mul__;
127 %newobject MEDCoupling::DataArrayInt::__rmul__;
128 %newobject MEDCoupling::DataArrayInt::__div__;
129 %newobject MEDCoupling::DataArrayInt::__rdiv__;
130 %newobject MEDCoupling::DataArrayInt::__mod__;
131 %newobject MEDCoupling::DataArrayInt::__rmod__;
132 %newobject MEDCoupling::DataArrayInt::__pow__;
133 %newobject MEDCoupling::DataArrayInt::__rpow__;
134 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
135 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
136 %newobject MEDCoupling::DataArrayChar::renumber;
137 %newobject MEDCoupling::DataArrayChar::renumberR;
138 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
139 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
140 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
141 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
142 %newobject MEDCoupling::DataArrayChar::Aggregate;
143 %newobject MEDCoupling::DataArrayChar::Meld;
144 %newobject MEDCoupling::DataArrayByte::New;
145 %newobject MEDCoupling::DataArrayByte::__iter__;
146 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
147 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
148 %newobject MEDCoupling::DataArrayChar::subArray;
149 %newobject MEDCoupling::DataArrayAsciiChar::New;
150 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
151 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
152 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
153 %newobject MEDCoupling::DataArrayDouble::New;
154 %newobject MEDCoupling::DataArrayDouble::__iter__;
155 %newobject MEDCoupling::DataArrayDouble::selectPartDef;
156 %newobject MEDCoupling::DataArrayDouble::convertToIntArr;
157 %newobject MEDCoupling::DataArrayDouble::convertToFloatArr;
158 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
159 %newobject MEDCoupling::DataArrayDouble::Aggregate;
160 %newobject MEDCoupling::DataArrayDouble::Meld;
161 %newobject MEDCoupling::DataArrayDouble::Dot;
162 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
163 %newobject MEDCoupling::DataArrayDouble::Add;
164 %newobject MEDCoupling::DataArrayDouble::Substract;
165 %newobject MEDCoupling::DataArrayDouble::Multiply;
166 %newobject MEDCoupling::DataArrayDouble::Divide;
167 %newobject MEDCoupling::DataArrayDouble::Pow;
168 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
169 %newobject MEDCoupling::DataArrayDouble::subArray;
170 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
171 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
172 %newobject MEDCoupling::DataArrayDouble::cumSum;
173 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
174 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
175 %newobject MEDCoupling::DataArrayDouble::negate;
176 %newobject MEDCoupling::DataArrayDouble::computeAbs;
177 %newobject MEDCoupling::DataArrayDouble::applyFunc;
178 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
179 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
180 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
181 %newobject MEDCoupling::DataArrayDouble::determinant;
182 %newobject MEDCoupling::DataArrayDouble::eigenValues;
183 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
184 %newobject MEDCoupling::DataArrayDouble::inverse;
185 %newobject MEDCoupling::DataArrayDouble::trace;
186 %newobject MEDCoupling::DataArrayDouble::deviator;
187 %newobject MEDCoupling::DataArrayDouble::magnitude;
188 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
189 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
190 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
191 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
192 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
193 %newobject MEDCoupling::DataArrayDouble::renumber;
194 %newobject MEDCoupling::DataArrayDouble::renumberR;
195 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
196 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
197 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
198 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
199 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
200 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
201 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
202 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
203 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
204 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
205 %newobject MEDCoupling::DataArrayDouble::cartesianize;
206 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
207 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
208 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
209 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
210 %newobject MEDCoupling::DataArrayDouble::__neg__;
211 %newobject MEDCoupling::DataArrayDouble::__radd__;
212 %newobject MEDCoupling::DataArrayDouble::__rsub__;
213 %newobject MEDCoupling::DataArrayDouble::__rmul__;
214 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
215 %newobject MEDCoupling::DataArrayDouble::__pow__;
216 %newobject MEDCoupling::DataArrayDouble::__rpow__;
217 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
219 %newobject MEDCoupling::PartDefinition::New;
220 %newobject MEDCoupling::PartDefinition::toDAI;
221 %newobject MEDCoupling::PartDefinition::__add__;
222 %newobject MEDCoupling::PartDefinition::composeWith;
223 %newobject MEDCoupling::PartDefinition::tryToSimplify;
224 %newobject MEDCoupling::DataArrayPartDefinition::New;
225 %newobject MEDCoupling::SlicePartDefinition::New;
228 %feature("unref") DataArray "$this->decrRef();"
229 %feature("unref") DataArrayDouble "$this->decrRef();"
230 %feature("unref") DataArrayInt "$this->decrRef();"
231 %feature("unref") DataArrayChar "$this->decrRef();"
232 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
233 %feature("unref") DataArrayByte "$this->decrRef();"
235 %feature("unref") PartDefinition "$this->decrRef();"
236 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
237 %feature("unref") SlicePartDefinition "$this->decrRef();"
239 namespace MEDCoupling
246 } MEDCouplingAxisType;
250 class PartDefinition : public RefCountObject, public TimeLabel
253 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
254 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
255 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
256 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
257 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
258 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
259 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
260 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
263 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
265 return (*self)+other;
268 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
271 bool ret0(self->isEqual(other,ret1));
272 PyObject *ret=PyTuple_New(2);
273 PyObject *ret0Py=ret0?Py_True:Py_False;
275 PyTuple_SetItem(ret,0,ret0Py);
276 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
280 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
282 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
286 virtual ~PartDefinition();
289 class DataArrayPartDefinition : public PartDefinition
292 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
295 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
297 return DataArrayPartDefinition::New(listOfIds);
300 std::string __str__() const throw(INTERP_KERNEL::Exception)
302 return self->getRepr();
305 std::string __repr__() const throw(INTERP_KERNEL::Exception)
307 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
308 oss << self->getRepr();
313 virtual ~DataArrayPartDefinition();
316 class SlicePartDefinition : public PartDefinition
319 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
320 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
323 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
325 return SlicePartDefinition::New(start,stop,step);
328 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
331 self->getSlice(a,b,c);
332 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
335 std::string __str__() const throw(INTERP_KERNEL::Exception)
337 return self->getRepr();
340 std::string __repr__() const throw(INTERP_KERNEL::Exception)
342 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
343 oss << self->getRepr();
348 virtual ~SlicePartDefinition();
351 class DataArray : public RefCountObject, public TimeLabel
354 void setName(const std::string& name);
355 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
356 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
357 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
358 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
359 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
360 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
361 std::string getName() const;
362 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
363 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
364 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
365 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
366 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
367 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
368 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
369 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
370 int getNumberOfComponents() const;
371 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
372 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
373 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
374 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
375 virtual void desallocate() throw(INTERP_KERNEL::Exception);
376 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
377 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
378 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
379 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
380 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
381 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
382 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
383 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
384 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
385 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
386 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
387 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
388 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
389 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
390 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
391 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
392 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
393 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
394 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
395 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
396 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
397 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
398 void updateTime() const;
401 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
403 const std::vector<std::string>& comps=self->getInfoOnComponents();
404 PyObject *ret=PyList_New((int)comps.size());
405 for(int i=0;i<(int)comps.size();i++)
406 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
410 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
412 std::vector<int> tmp;
413 convertPyToNewIntArr3(li,tmp);
414 self->copyPartOfStringInfoFrom(other,tmp);
417 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
419 std::vector<int> tmp;
420 convertPyToNewIntArr3(li,tmp);
421 self->copyPartOfStringInfoFrom2(tmp,other);
424 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
427 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
428 if (!SWIG_IsOK(res1))
431 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
432 if(size!=self->getNumberOfTuples())
434 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
436 self->renumberInPlace(tmp);
440 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
442 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
443 da2->checkAllocated();
444 int size=self->getNumberOfTuples();
445 if(size!=self->getNumberOfTuples())
447 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
449 self->renumberInPlace(da2->getConstPointer());
453 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
456 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
457 if (!SWIG_IsOK(res1))
460 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
461 if(size!=self->getNumberOfTuples())
463 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
465 self->renumberInPlaceR(tmp);
469 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
471 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
472 da2->checkAllocated();
473 int size=self->getNumberOfTuples();
474 if(size!=self->getNumberOfTuples())
476 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
478 self->renumberInPlaceR(da2->getConstPointer());
482 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
483 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
485 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
486 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
487 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
488 DataArrayInt *tuplesSelecPtr2=0;
491 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
493 throw INTERP_KERNEL::Exception(msg);
495 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
498 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
500 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
501 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
504 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
506 std::vector<std::pair<int,int> > ranges;
507 convertPyToVectorPairInt(li,ranges);
508 return self->selectByTupleRanges(ranges);
511 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
514 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
515 if (!SWIG_IsOK(res1))
518 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
519 return self->selectByTupleId(tmp,tmp+size);
523 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
525 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
526 da2->checkAllocated();
527 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
531 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
534 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
535 if (!SWIG_IsOK(res1))
538 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
539 return self->selectByTupleIdSafe(tmp,tmp+size);
543 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
545 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
546 da2->checkAllocated();
547 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
551 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
553 std::vector<int> tmp;
554 convertPyToNewIntArr3(li,tmp);
555 DataArray *ret=self->keepSelectedComponents(tmp);
556 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
559 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
561 if(!PySlice_Check(slic))
562 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
563 Py_ssize_t strt=2,stp=2,step=2;
564 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
565 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
567 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
568 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
571 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
573 if(!PySlice_Check(slic))
574 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
575 Py_ssize_t strt=2,stp=2,step=2;
576 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
577 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
579 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
580 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
583 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
585 if(!PySlice_Check(slic))
586 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
587 Py_ssize_t strt=2,stp=2,step=2;
588 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
589 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
590 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
593 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
595 if(!PySlice_Check(slic))
596 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
597 Py_ssize_t strt=2,stp=2,step=2;
598 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
599 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
600 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
603 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
605 std::vector<const DataArray *> tmp;
606 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
607 return DataArray::Aggregate(tmp);
610 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
612 if(!PySlice_Check(slic))
613 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
614 Py_ssize_t strt=2,stp=2,step=2;
615 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
616 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
617 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
620 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
622 if(!PySlice_Check(slic))
623 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
624 Py_ssize_t strt=2,stp=2,step=2;
625 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
626 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
627 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
630 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
632 PyObject *ret(PyTuple_New(2));
633 std::string a0(self->getName());
634 const std::vector<std::string> &a1(self->getInfoOnComponents());
635 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
638 PyObject *ret1(PyList_New(sz));
639 for(int i=0;i<sz;i++)
640 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
641 PyTuple_SetItem(ret,1,ret1);
646 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
648 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 !";
649 if(!PyTuple_Check(inp))
650 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
651 int sz(PyTuple_Size(inp));
653 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
654 PyObject *a0(PyTuple_GetItem(inp,0));
655 if(!PyString_Check(a0))
656 throw INTERP_KERNEL::Exception(MSG);
657 PyObject *a1(PyTuple_GetItem(inp,1));
658 std::vector<std::string> a1cpp;
659 if(!fillStringVector(a1,a1cpp))
660 throw INTERP_KERNEL::Exception(MSG);
661 self->setName(PyString_AsString(a0));
662 self->setInfoOnComponents(a1cpp);
667 class DataArrayDouble;
669 class DataArrayFloat : public DataArray
672 static DataArrayFloat *New();
673 void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
674 bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
675 bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
676 bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
677 void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
678 void iota(float init=0.) throw(INTERP_KERNEL::Exception);
679 DataArrayFloatIterator *iterator() throw(INTERP_KERNEL::Exception);
682 DataArrayFloat() throw(INTERP_KERNEL::Exception)
684 return DataArrayFloat::New();
687 static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
689 return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
692 DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
694 return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
697 DataArrayFloatIterator *__iter__() throw(INTERP_KERNEL::Exception)
699 return self->iterator();
702 std::string __repr__() const throw(INTERP_KERNEL::Exception)
704 std::ostringstream oss;
705 self->reprQuickOverview(oss);
709 std::string __str__() const throw(INTERP_KERNEL::Exception)
711 return self->reprNotTooLong();
714 int __len__() const throw(INTERP_KERNEL::Exception)
716 if(self->isAllocated())
718 return self->getNumberOfTuples();
722 throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
726 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
728 const float *vals(self->begin());
729 return convertDblArrToPyList<float>(vals,self->getNbOfElems());
732 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
734 const float *vals(self->begin());
735 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
736 return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
739 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception)
741 MCAuto<DataArrayDouble> ret(self->convertToDblArr());
745 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
747 return DataArrayT__getitem<float>(self,obj);
750 DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
752 return DataArrayT__setitem__<float>(self,obj,value);
755 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
757 return DataArrayT_iadd<float>(trueSelf,obj,self);
760 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
762 return DataArrayT_isub<float>(trueSelf,obj,self);
765 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
767 return DataArrayT_imul<float>(trueSelf,obj,self);
770 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
772 return DataArrayT_idiv<float>(trueSelf,obj,self);
776 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
778 return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
785 class DataArrayFloatTuple;
787 class DataArrayFloatIterator
790 DataArrayFloatIterator(DataArrayFloat *da);
791 ~DataArrayFloatIterator();
796 DataArrayFloatTuple *ret=self->nextt();
798 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple,SWIG_POINTER_OWN|0);
801 PyErr_SetString(PyExc_StopIteration,"No more data.");
808 class DataArrayFloatTuple
811 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
812 DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
815 std::string __str__() const throw(INTERP_KERNEL::Exception)
820 float __float__() const throw(INTERP_KERNEL::Exception)
822 return self->floatValue();
825 DataArrayFloat *buildDAFloat() throw(INTERP_KERNEL::Exception)
827 return self->buildDAFloat(1,self->getNumberOfCompo());
830 /*PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
832 MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
833 MEDCoupling_DataArrayFloat____imul___(ret,0,obj);
834 Py_XINCREF(trueSelf);
838 PyObject *__len__() throw(INTERP_KERNEL::Exception)
840 return PyInt_FromLong(self->getNumberOfCompo());
846 class DataArrayDoubleIterator;
848 class DataArrayDouble : public DataArray
851 static DataArrayDouble *New();
852 double doubleValue() const throw(INTERP_KERNEL::Exception);
853 bool empty() const throw(INTERP_KERNEL::Exception);
854 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
855 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
856 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
857 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
858 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
859 double popBackSilent() throw(INTERP_KERNEL::Exception);
860 void pack() const throw(INTERP_KERNEL::Exception);
861 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
862 void fillWithZero() throw(INTERP_KERNEL::Exception);
863 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
864 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
865 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
866 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
867 void reverse() throw(INTERP_KERNEL::Exception);
868 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
869 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
870 std::string repr() const throw(INTERP_KERNEL::Exception);
871 std::string reprZip() const throw(INTERP_KERNEL::Exception);
872 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
873 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
874 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
875 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
876 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
877 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
878 void transpose() throw(INTERP_KERNEL::Exception);
879 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
880 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
881 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
882 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
883 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
884 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
885 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
886 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
887 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
888 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
889 double front() const throw(INTERP_KERNEL::Exception);
890 double back() const throw(INTERP_KERNEL::Exception);
891 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
892 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
893 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
894 double *getPointer() throw(INTERP_KERNEL::Exception);
895 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
896 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
897 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
898 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
899 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
900 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
901 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
902 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
903 double getAverageValue() const throw(INTERP_KERNEL::Exception);
904 double norm2() const throw(INTERP_KERNEL::Exception);
905 double normMax() const throw(INTERP_KERNEL::Exception);
906 double normMin() const throw(INTERP_KERNEL::Exception);
907 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
908 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
909 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
910 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
911 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
912 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
913 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
914 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
915 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
916 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
917 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
918 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
919 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
920 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
921 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
922 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
923 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
924 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
925 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
926 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
927 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
928 void abs() throw(INTERP_KERNEL::Exception);
929 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
930 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
931 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
932 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
933 void applyPow(double val) throw(INTERP_KERNEL::Exception);
934 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
935 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
936 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
937 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
938 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
939 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
940 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
941 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
942 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
943 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
944 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
945 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
946 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
947 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
948 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
949 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
950 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
951 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
952 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
953 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
954 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
955 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
956 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
957 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
958 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
959 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
960 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
961 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
964 DataArrayDouble() throw(INTERP_KERNEL::Exception)
966 return DataArrayDouble::New();
969 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
971 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
974 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
976 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
979 DataArrayDouble *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
981 MCAuto<DataArrayDouble> ret(self->selectPartDef(pd));
985 DataArrayDouble *cumSum() const throw(INTERP_KERNEL::Exception)
987 MCAuto<DataArrayDouble> ret(self->cumSum());
991 DataArrayFloat *convertToFloatArr() const throw(INTERP_KERNEL::Exception)
993 MCAuto<DataArrayFloat> ret(self->convertToFloatArr());
997 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception)
999 MCAuto<DataArrayInt> ret(self->convertToIntArr());
1003 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
1006 std::vector<double> bb;
1008 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
1009 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
1010 self->pushBackValsSilent(tmp,tmp+nbTuples);
1013 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1015 std::ostringstream oss;
1016 self->reprQuickOverview(oss);
1020 std::string __str__() const throw(INTERP_KERNEL::Exception)
1022 return self->reprNotTooLong();
1025 double __float__() const throw(INTERP_KERNEL::Exception)
1027 return self->doubleValue();
1030 int __len__() const throw(INTERP_KERNEL::Exception)
1032 if(self->isAllocated())
1034 return self->getNumberOfTuples();
1038 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
1042 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
1044 return self->iterator();
1047 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1049 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 !";
1050 if(PyList_Check(li) || PyTuple_Check(li))
1054 if(PyInt_Check(nbOfTuples))
1056 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1058 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
1061 if(PyInt_Check(nbOfComp))
1062 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
1063 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1065 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
1066 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
1067 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1070 throw INTERP_KERNEL::Exception(msg);
1073 {//DataArrayDouble.setValues([1.,3.,4.],3)
1075 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
1076 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1080 throw INTERP_KERNEL::Exception(msg);
1083 {// DataArrayDouble.setValues([1.,3.,4.])
1084 int tmpp1=-1,tmpp2=-1;
1085 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
1086 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1090 throw INTERP_KERNEL::Exception(msg);
1093 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
1095 const double *vals(self->begin());
1096 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
1100 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
1102 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1106 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1109 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1110 PyObject *ret=PyTuple_New(2);
1111 PyObject *ret0Py=ret0?Py_True:Py_False;
1113 PyTuple_SetItem(ret,0,ret0Py);
1114 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1118 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1120 const double *vals(self->begin());
1121 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1122 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1125 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1127 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1129 DataArrayDouble *a,*a2;
1130 DataArrayDoubleTuple *aa,*aa2;
1131 std::vector<double> bb,bb2;
1133 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1134 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1135 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1139 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1141 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1143 DataArrayDouble *a,*a2;
1144 DataArrayDoubleTuple *aa,*aa2;
1145 std::vector<double> bb,bb2;
1147 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1149 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1150 return convertDblArrToPyListOfTuple<double>(res,3,3);
1153 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1155 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1157 DataArrayDouble *a,*a2;
1158 DataArrayDoubleTuple *aa,*aa2;
1159 std::vector<double> bb,bb2;
1161 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1162 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1163 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1166 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1169 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1170 if (!SWIG_IsOK(res1))
1173 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1174 if(size!=self->getNumberOfTuples())
1176 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1178 return self->renumber(tmp);
1182 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1184 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1185 da2->checkAllocated();
1186 int size=self->getNumberOfTuples();
1187 if(size!=self->getNumberOfTuples())
1189 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1191 return self->renumber(da2->getConstPointer());
1195 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1198 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1199 if (!SWIG_IsOK(res1))
1202 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1203 if(size!=self->getNumberOfTuples())
1205 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1207 return self->renumberR(tmp);
1211 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1213 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1214 da2->checkAllocated();
1215 int size=self->getNumberOfTuples();
1216 if(size!=self->getNumberOfTuples())
1218 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1220 return self->renumberR(da2->getConstPointer());
1224 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1227 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1228 if (!SWIG_IsOK(res1))
1231 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1232 if(size!=self->getNumberOfTuples())
1234 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1236 return self->renumberAndReduce(tmp,newNbOfTuple);
1240 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1242 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1243 da2->checkAllocated();
1244 int size=self->getNumberOfTuples();
1245 if(size!=self->getNumberOfTuples())
1247 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1249 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1253 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1255 int thisTupleId,otherTupleId;
1256 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1257 PyObject *ret=PyTuple_New(3);
1258 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1259 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1260 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1264 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1267 double r1=self->getMaxValue(tmp);
1268 PyObject *ret=PyTuple_New(2);
1269 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1270 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1274 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1277 double r1=self->getMaxValue2(tmp);
1278 PyObject *ret=PyTuple_New(2);
1279 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1280 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1284 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1287 double r1=self->getMinValue(tmp);
1288 PyObject *ret=PyTuple_New(2);
1289 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1290 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1294 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1297 double r1=self->getMinValue2(tmp);
1298 PyObject *ret=PyTuple_New(2);
1299 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1300 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1304 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1306 int nbOfCompo(self->getNumberOfComponents());
1307 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1308 self->getMinMaxPerComponent(tmp);
1309 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1313 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1315 int sz=self->getNumberOfComponents();
1316 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1317 self->accumulate(tmp);
1318 return convertDblArrToPyList<double>(tmp,sz);
1321 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1324 std::vector<int> val2;
1325 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1326 return self->accumulatePerChunck(bg,bg+sz);
1329 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1331 DataArrayInt *comm, *commIndex;
1332 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1333 PyObject *res = PyList_New(2);
1334 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1335 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1339 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1343 DataArrayDoubleTuple *aa;
1344 std::vector<double> bb;
1346 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1347 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1349 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1350 PyObject *ret=PyTuple_New(2);
1351 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1352 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1356 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1358 std::vector<int> tmp;
1359 convertPyToNewIntArr3(li,tmp);
1360 self->setSelectedComponents(a,tmp);
1363 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1365 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1366 std::size_t sz(retCpp.size());
1367 PyObject *res(PyList_New(sz));
1368 for(std::size_t i=0;i<sz;i++)
1369 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1373 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1375 int sz=self->getNumberOfComponents();
1376 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1377 self->getTuple(tupleId,tmp);
1378 return convertDblArrToPyList<double>(tmp,sz);
1381 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1383 std::vector<const DataArrayDouble *> tmp;
1384 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1385 return DataArrayDouble::Aggregate(tmp);
1388 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1390 std::vector<const DataArrayDouble *> tmp;
1391 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1392 return DataArrayDouble::Meld(tmp);
1395 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1399 DataArrayDoubleTuple *aa;
1400 std::vector<double> bb;
1402 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1403 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1404 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1405 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1406 DataArrayInt *c=0,*cI=0;
1407 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1408 PyObject *ret=PyTuple_New(2);
1409 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1410 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1414 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1416 DataArrayInt *ret1=0;
1417 bool ret0=self->areIncludedInMe(other,prec,ret1);
1418 PyObject *ret=PyTuple_New(2);
1419 PyObject *ret0Py=ret0?Py_True:Py_False;
1421 PyTuple_SetItem(ret,0,ret0Py);
1422 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1426 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1428 return DataArrayT__getitem<double>(self,obj);
1431 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1433 return DataArrayT__setitem__<double>(self,obj,value);
1436 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1438 return self->negate();
1441 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1443 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1446 DataArrayDoubleTuple *aa;
1447 std::vector<double> bb;
1450 #ifndef WITHOUT_AUTOFIELD
1452 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1454 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1457 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1458 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1460 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1463 throw INTERP_KERNEL::Exception(msg);
1467 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1472 MCAuto<DataArrayDouble> ret=self->deepCopy();
1473 ret->applyLin(1.,val);
1474 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1478 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1482 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1483 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1487 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1488 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1491 throw INTERP_KERNEL::Exception(msg);
1495 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1497 const char msg[]="Unexpected situation in __radd__ !";
1500 DataArrayDoubleTuple *aa;
1501 std::vector<double> bb;
1503 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1508 MCAuto<DataArrayDouble> ret=self->deepCopy();
1509 ret->applyLin(1.,val);
1514 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1515 return DataArrayDouble::Add(self,aaa);
1519 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1520 return DataArrayDouble::Add(self,aaa);
1523 throw INTERP_KERNEL::Exception(msg);
1527 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1529 return DataArrayT_iadd<double>(trueSelf,obj,self);
1532 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1534 const char msg[]="Unexpected situation in __sub__ !";
1537 DataArrayDoubleTuple *aa;
1538 std::vector<double> bb;
1541 #ifndef WITHOUT_AUTOFIELD
1543 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1545 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1548 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1549 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1551 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1554 throw INTERP_KERNEL::Exception(msg);
1558 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1563 MCAuto<DataArrayDouble> ret=self->deepCopy();
1564 ret->applyLin(1.,-val);
1565 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1569 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1573 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1574 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1578 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1579 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1582 throw INTERP_KERNEL::Exception(msg);
1586 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1588 const char msg[]="Unexpected situation in __rsub__ !";
1591 DataArrayDoubleTuple *aa;
1592 std::vector<double> bb;
1594 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1599 MCAuto<DataArrayDouble> ret=self->deepCopy();
1600 ret->applyLin(-1.,val);
1605 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1606 return DataArrayDouble::Substract(aaa,self);
1610 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1611 return DataArrayDouble::Substract(aaa,self);
1614 throw INTERP_KERNEL::Exception(msg);
1618 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1620 return DataArrayT_isub<double>(trueSelf,obj,self);
1623 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1625 const char msg[]="Unexpected situation in __mul__ !";
1628 DataArrayDoubleTuple *aa;
1629 std::vector<double> bb;
1632 #ifndef WITHOUT_AUTOFIELD
1634 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1636 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1639 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1640 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1642 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1645 throw INTERP_KERNEL::Exception(msg);
1649 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1654 MCAuto<DataArrayDouble> ret=self->deepCopy();
1655 ret->applyLin(val,0.);
1656 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1660 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1664 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1665 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1669 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1670 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1673 throw INTERP_KERNEL::Exception(msg);
1677 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1679 const char msg[]="Unexpected situation in __rmul__ !";
1682 DataArrayDoubleTuple *aa;
1683 std::vector<double> bb;
1685 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1690 MCAuto<DataArrayDouble> ret=self->deepCopy();
1691 ret->applyLin(val,0.);
1696 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1697 return DataArrayDouble::Multiply(self,aaa);
1701 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1702 return DataArrayDouble::Multiply(self,aaa);
1705 throw INTERP_KERNEL::Exception(msg);
1709 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1711 return DataArrayT_imul<double>(trueSelf,obj,self);
1714 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1716 const char msg[]="Unexpected situation in __div__ !";
1719 DataArrayDoubleTuple *aa;
1720 std::vector<double> bb;
1723 #ifndef WITHOUT_AUTOFIELD
1725 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1727 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1730 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1731 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1733 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1736 throw INTERP_KERNEL::Exception(msg);
1740 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1746 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1747 MCAuto<DataArrayDouble> ret=self->deepCopy();
1748 ret->applyLin(1/val,0.);
1749 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1753 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1757 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1758 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1762 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1763 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1766 throw INTERP_KERNEL::Exception(msg);
1770 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1772 const char msg[]="Unexpected situation in __rdiv__ !";
1775 DataArrayDoubleTuple *aa;
1776 std::vector<double> bb;
1778 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1783 MCAuto<DataArrayDouble> ret=self->deepCopy();
1789 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1790 return DataArrayDouble::Divide(aaa,self);
1794 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1795 return DataArrayDouble::Divide(aaa,self);
1798 throw INTERP_KERNEL::Exception(msg);
1802 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1804 return DataArrayT_idiv<double>(trueSelf,obj,self);
1807 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1809 const char msg[]="Unexpected situation in __pow__ !";
1812 DataArrayDoubleTuple *aa;
1813 std::vector<double> bb;
1815 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1820 MCAuto<DataArrayDouble> ret=self->deepCopy();
1826 return DataArrayDouble::Pow(self,a);
1830 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1831 return DataArrayDouble::Pow(self,aaa);
1835 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1836 return DataArrayDouble::Pow(self,aaa);
1839 throw INTERP_KERNEL::Exception(msg);
1843 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1845 const char msg[]="Unexpected situation in __rpow__ !";
1848 DataArrayDoubleTuple *aa;
1849 std::vector<double> bb;
1851 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1856 MCAuto<DataArrayDouble> ret=self->deepCopy();
1857 ret->applyRPow(val);
1862 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1863 return DataArrayDouble::Pow(aaa,self);
1867 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1868 return DataArrayDouble::Pow(aaa,self);
1871 throw INTERP_KERNEL::Exception(msg);
1875 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1877 const char msg[]="Unexpected situation in __ipow__ !";
1880 DataArrayDoubleTuple *aa;
1881 std::vector<double> bb;
1883 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1888 self->applyPow(val);
1889 Py_XINCREF(trueSelf);
1895 Py_XINCREF(trueSelf);
1900 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1901 self->powEqual(aaa);
1902 Py_XINCREF(trueSelf);
1907 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1908 self->powEqual(aaa);
1909 Py_XINCREF(trueSelf);
1913 throw INTERP_KERNEL::Exception(msg);
1917 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1919 DataArrayInt *c=0,*cI=0;
1921 self->computeTupleIdsNearTuples(other,eps,c,cI);
1922 PyObject *ret=PyTuple_New(2);
1923 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1924 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1928 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1930 DataArrayInt *ret1=0;
1931 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1932 PyObject *ret=PyTuple_New(2);
1933 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1934 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1939 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
1941 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
1944 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
1947 if(!self->isAllocated())
1948 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
1949 PyObject *ret(PyTuple_New(1));
1950 PyObject *ret0(PyDict_New());
1951 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
1952 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
1953 PyObject *tmp1(PyInt_FromLong(0));
1954 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
1955 PyTuple_SetItem(ret,0,ret0);
1959 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
1965 class DataArrayDoubleTuple;
1967 class DataArrayDoubleIterator
1970 DataArrayDoubleIterator(DataArrayDouble *da);
1971 ~DataArrayDoubleIterator();
1976 DataArrayDoubleTuple *ret=self->nextt();
1978 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1981 PyErr_SetString(PyExc_StopIteration,"No more data.");
1988 class DataArrayDoubleTuple
1991 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
1992 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
1995 std::string __str__() const throw(INTERP_KERNEL::Exception)
1997 return self->repr();
2000 double __float__() const throw(INTERP_KERNEL::Exception)
2002 return self->doubleValue();
2005 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2007 return self->buildDADouble(1,self->getNumberOfCompo());
2010 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2012 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2013 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2014 Py_XINCREF(trueSelf);
2018 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2020 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2021 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2022 Py_XINCREF(trueSelf);
2026 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2028 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2029 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2030 Py_XINCREF(trueSelf);
2034 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2036 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2037 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2038 Py_XINCREF(trueSelf);
2042 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2044 return PyInt_FromLong(self->getNumberOfCompo());
2047 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2049 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2052 std::vector<int> multiVal;
2053 std::pair<int, std::pair<int,int> > slic;
2054 MEDCoupling::DataArrayInt *daIntTyypp=0;
2055 const double *pt=self->getConstPointer();
2056 int nbc=self->getNumberOfCompo();
2057 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2064 std::ostringstream oss;
2065 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2066 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2070 return PyFloat_FromDouble(pt[singleVal]);
2074 return PyFloat_FromDouble(pt[nbc+singleVal]);
2077 std::ostringstream oss;
2078 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2079 throw INTERP_KERNEL::Exception(oss.str().c_str());
2085 PyObject *t=PyTuple_New(multiVal.size());
2086 for(int j=0;j<(int)multiVal.size();j++)
2088 int cid=multiVal[j];
2091 std::ostringstream oss;
2092 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2093 throw INTERP_KERNEL::Exception(oss.str().c_str());
2095 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2101 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2102 PyObject *t=PyTuple_New(sz);
2103 for(int j=0;j<sz;j++)
2104 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2108 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2112 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2114 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2115 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2118 std::vector<double> multiValV;
2119 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2120 int nbc=self->getNumberOfCompo();
2121 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2123 std::vector<int> multiVal;
2124 std::pair<int, std::pair<int,int> > slic;
2125 MEDCoupling::DataArrayInt *daIntTyypp=0;
2126 double *pt=self->getPointer();
2127 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2134 std::ostringstream oss;
2135 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2136 throw INTERP_KERNEL::Exception(oss.str().c_str());
2142 pt[singleVal]=singleValV;
2147 if(multiValV.size()!=1)
2149 std::ostringstream oss;
2150 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2151 throw INTERP_KERNEL::Exception(oss.str().c_str());
2153 pt[singleVal]=multiValV[0];
2158 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2162 throw INTERP_KERNEL::Exception(msg);
2171 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2175 std::ostringstream oss;
2176 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2177 throw INTERP_KERNEL::Exception(oss.str().c_str());
2185 if(multiVal.size()!=multiValV.size())
2187 std::ostringstream oss;
2188 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2189 throw INTERP_KERNEL::Exception(oss.str().c_str());
2191 for(int i=0;i<(int)multiVal.size();i++)
2193 int pos=multiVal[i];
2196 std::ostringstream oss;
2197 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2198 throw INTERP_KERNEL::Exception(oss.str().c_str());
2200 pt[multiVal[i]]=multiValV[i];
2206 const double *ptV=daIntTyyppV->getConstPointer();
2207 if(nbc>daIntTyyppV->getNumberOfCompo())
2209 std::ostringstream oss;
2210 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2211 throw INTERP_KERNEL::Exception(oss.str().c_str());
2213 std::copy(ptV,ptV+nbc,pt);
2217 throw INTERP_KERNEL::Exception(msg);
2222 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2227 for(int j=0;j<sz;j++)
2228 pt[slic.first+j*slic.second.second]=singleValV;
2233 if(sz!=(int)multiValV.size())
2235 std::ostringstream oss;
2236 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2237 throw INTERP_KERNEL::Exception(oss.str().c_str());
2239 for(int j=0;j<sz;j++)
2240 pt[slic.first+j*slic.second.second]=multiValV[j];
2245 const double *ptV=daIntTyyppV->getConstPointer();
2246 if(sz>daIntTyyppV->getNumberOfCompo())
2248 std::ostringstream oss;
2249 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2250 throw INTERP_KERNEL::Exception(oss.str().c_str());
2252 for(int j=0;j<sz;j++)
2253 pt[slic.first+j*slic.second.second]=ptV[j];
2257 throw INTERP_KERNEL::Exception(msg);
2261 throw INTERP_KERNEL::Exception(msg);
2267 class DataArrayIntIterator;
2269 class DataArrayInt : public DataArray
2272 static DataArrayInt *New();
2273 int intValue() const throw(INTERP_KERNEL::Exception);
2274 int getHashCode() const throw(INTERP_KERNEL::Exception);
2275 bool empty() const throw(INTERP_KERNEL::Exception);
2276 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2277 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2278 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2279 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2280 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2281 int popBackSilent() throw(INTERP_KERNEL::Exception);
2282 void pack() const throw(INTERP_KERNEL::Exception);
2283 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2284 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2285 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2286 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2287 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2288 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2289 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2290 void reverse() throw(INTERP_KERNEL::Exception);
2291 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2292 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2293 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2294 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2295 void fillWithZero() throw(INTERP_KERNEL::Exception);
2296 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2297 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2298 std::string repr() const throw(INTERP_KERNEL::Exception);
2299 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2300 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2301 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2302 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2303 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2304 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2305 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2306 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2307 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2308 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2309 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2310 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2311 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2312 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2313 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2314 void transpose() throw(INTERP_KERNEL::Exception);
2315 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2316 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2317 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2318 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2319 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2320 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2321 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2322 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2323 int front() const throw(INTERP_KERNEL::Exception);
2324 int back() const throw(INTERP_KERNEL::Exception);
2325 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2326 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2327 int *getPointer() throw(INTERP_KERNEL::Exception);
2328 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2329 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2330 const int *begin() const throw(INTERP_KERNEL::Exception);
2331 const int *end() const throw(INTERP_KERNEL::Exception);
2332 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2333 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2334 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2335 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2336 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2337 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2338 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2339 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2340 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2341 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2342 int count(int value) const throw(INTERP_KERNEL::Exception);
2343 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2344 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2345 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2346 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2347 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2348 void abs() throw(INTERP_KERNEL::Exception);
2349 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2350 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2351 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2352 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2353 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2354 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2355 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2356 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2357 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2358 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2359 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2360 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2361 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2362 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2363 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2364 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2365 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2366 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2367 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2368 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2369 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2370 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2371 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2372 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2373 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2374 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2375 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2376 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2377 void computeOffsets() throw(INTERP_KERNEL::Exception);
2378 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2379 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2380 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2381 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2382 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2383 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2384 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2385 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2386 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2387 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2388 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2389 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2390 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2391 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2392 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2393 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2394 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2395 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2396 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2398 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2401 DataArrayInt() throw(INTERP_KERNEL::Exception)
2403 return DataArrayInt::New();
2406 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2408 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)";
2409 std::string msg(msgBase);
2411 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2414 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2418 if(PyInt_Check(nbOfTuples))
2420 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2422 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2425 if(PyInt_Check(nbOfComp))
2426 {//DataArrayInt.New([1,3,4,5],2,2)
2427 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2429 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2430 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2431 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2432 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2436 throw INTERP_KERNEL::Exception(msg.c_str());
2439 {//DataArrayInt.New([1,3,4],3)
2440 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2442 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2443 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2448 throw INTERP_KERNEL::Exception(msg.c_str());
2451 {// DataArrayInt.New([1,3,4])
2452 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2453 int tmpp1=-1,tmpp2=-1;
2454 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2455 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2459 else if(PyInt_Check(elt0))
2461 int nbOfTuples1=PyInt_AS_LONG(elt0);
2463 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2468 if(PyInt_Check(nbOfTuples))
2469 {//DataArrayInt.New(5,2)
2470 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2472 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2473 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2474 ret->alloc(nbOfTuples1,nbOfCompo);
2478 throw INTERP_KERNEL::Exception(msg.c_str());
2481 throw INTERP_KERNEL::Exception(msg.c_str());
2484 {//DataArrayInt.New(5)
2485 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2486 ret->alloc(nbOfTuples1,1);
2491 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2492 {//DataArrayInt.New(numpyArray)
2493 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2497 throw INTERP_KERNEL::Exception(msg.c_str());
2498 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2501 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2503 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2506 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception)
2508 MCAuto<DataArrayDouble> ret(self->convertToDblArr());
2512 DataArrayFloat *convertToFloatArr() const throw(INTERP_KERNEL::Exception)
2514 MCAuto<DataArrayFloat> ret(self->convertToFloatArr());
2518 std::string __str__() const throw(INTERP_KERNEL::Exception)
2520 return self->reprNotTooLong();
2523 int __len__() const throw(INTERP_KERNEL::Exception)
2525 if(self->isAllocated())
2527 return self->getNumberOfTuples();
2531 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2535 int __int__() const throw(INTERP_KERNEL::Exception)
2537 return self->intValue();
2540 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2542 return self->iterator();
2545 DataArrayInt *fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception)
2547 MCAuto<DataArrayInt> ret(self->fromLinkedListOfPairToList());
2551 DataArrayInt *findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
2553 MCAuto<DataArrayInt> ret(self->findIdsGreaterOrEqualTo(val));
2557 DataArrayInt *findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception)
2559 MCAuto<DataArrayInt> ret(self->findIdsGreaterThan(val));
2563 DataArrayInt *findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
2565 MCAuto<DataArrayInt> ret(self->findIdsLowerOrEqualTo(val));
2569 DataArrayInt *findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception)
2571 MCAuto<DataArrayInt> ret(self->findIdsLowerThan(val));
2575 DataArrayInt *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
2577 MCAuto<DataArrayInt> ret(self->selectPartDef(pd));
2581 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2583 int sz=self->getNumberOfComponents();
2584 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2585 self->accumulate(tmp);
2586 return convertIntArrToPyList(tmp,sz);
2589 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2592 std::vector<int> val2;
2593 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2594 return self->accumulatePerChunck(bg,bg+sz);
2597 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2600 std::vector<int> val2;
2601 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2602 return self->findIdsEqualTuple(bg,bg+sz);
2605 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2607 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2608 PyObject *ret=PyList_New(slcs.size());
2609 for(std::size_t i=0;i<slcs.size();i++)
2610 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2614 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2616 if(!PySlice_Check(slic))
2617 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2618 Py_ssize_t strt=2,stp=2,step=2;
2619 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2620 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2621 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2622 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 !");
2623 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2626 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2629 self->getMinMaxValues(a,b);
2630 PyObject *ret=PyTuple_New(2);
2631 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2632 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2636 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2638 int newNbOfTuples=-1;
2639 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2640 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2641 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2642 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2643 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2644 PyObject *ret=PyTuple_New(2);
2645 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2646 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2650 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2652 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2653 int szArr,sw,iTypppArr;
2654 std::vector<int> stdvecTyyppArr;
2655 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2656 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2657 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2661 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2663 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 !";
2664 if(PyList_Check(li) || PyTuple_Check(li))
2666 if(nbOfTuples && nbOfTuples != Py_None)
2668 if(PyInt_Check(nbOfTuples))
2670 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2672 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2673 if(nbOfComp && nbOfComp != Py_None)
2675 if(PyInt_Check(nbOfComp))
2676 {//DataArrayInt.setValues([1,3,4,5],2,2)
2677 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2679 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2680 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2681 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2684 throw INTERP_KERNEL::Exception(msg);
2687 {//DataArrayInt.setValues([1,3,4],3)
2689 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2690 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2694 throw INTERP_KERNEL::Exception(msg);
2697 {// DataArrayInt.setValues([1,3,4])
2698 int tmpp1=-1,tmpp2=-1;
2699 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2700 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2704 throw INTERP_KERNEL::Exception(msg);
2707 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2709 const int *vals=self->getConstPointer();
2710 return convertIntArrToPyList(vals,self->getNbOfElems());
2714 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2716 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2720 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2723 bool ret0=self->isEqualIfNotWhy(other,ret1);
2724 PyObject *ret=PyTuple_New(2);
2725 PyObject *ret0Py=ret0?Py_True:Py_False;
2727 PyTuple_SetItem(ret,0,ret0Py);
2728 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2732 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2734 const int *vals=self->getConstPointer();
2735 int nbOfComp=self->getNumberOfComponents();
2736 int nbOfTuples=self->getNumberOfTuples();
2737 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2740 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2742 std::vector<const DataArrayInt *> groups;
2743 std::vector< std::vector<int> > fidsOfGroups;
2744 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2745 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2746 PyObject *ret = PyList_New(2);
2747 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2748 int sz=fidsOfGroups.size();
2749 PyObject *ret1 = PyList_New(sz);
2750 for(int i=0;i<sz;i++)
2751 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2752 PyList_SetItem(ret,1,ret1);
2756 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2759 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2760 if (!SWIG_IsOK(res1))
2763 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2764 self->transformWithIndArr(tmp,tmp+size);
2768 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2769 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2773 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2777 std::vector<int> multiVal;
2778 std::pair<int, std::pair<int,int> > slic;
2779 MEDCoupling::DataArrayInt *daIntTyypp=0;
2780 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2784 return self->findIdsEqualList(&singleVal,&singleVal+1);
2786 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2788 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2790 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2794 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2798 std::vector<int> multiVal;
2799 std::pair<int, std::pair<int,int> > slic;
2800 MEDCoupling::DataArrayInt *daIntTyypp=0;
2801 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2805 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2807 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2809 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2811 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2815 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2817 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2819 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2820 if (!SWIG_IsOK(res1))
2823 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2824 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2828 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2830 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2831 da2->checkAllocated();
2832 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2834 PyObject *ret = PyList_New(3);
2835 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2836 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2837 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2841 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2844 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2845 if (!SWIG_IsOK(res1))
2848 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2849 return self->transformWithIndArrR(tmp,tmp+size);
2853 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2854 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2858 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2861 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2862 if (!SWIG_IsOK(res1))
2865 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2866 if(size!=self->getNumberOfTuples())
2868 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2870 return self->renumberAndReduce(tmp,newNbOfTuple);
2874 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2876 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2877 da2->checkAllocated();
2878 int size=self->getNumberOfTuples();
2879 if(size!=self->getNumberOfTuples())
2881 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2883 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2887 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2890 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2891 if (!SWIG_IsOK(res1))
2894 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2895 if(size!=self->getNumberOfTuples())
2897 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2899 return self->renumber(tmp);
2903 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2905 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2906 da2->checkAllocated();
2907 int size=self->getNumberOfTuples();
2908 if(size!=self->getNumberOfTuples())
2910 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2912 return self->renumber(da2->getConstPointer());
2916 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2919 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2920 if (!SWIG_IsOK(res1))
2923 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2924 if(size!=self->getNumberOfTuples())
2926 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2928 return self->renumberR(tmp);
2932 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2934 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2935 da2->checkAllocated();
2936 int size=self->getNumberOfTuples();
2937 if(size!=self->getNumberOfTuples())
2939 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2941 return self->renumberR(da2->getConstPointer());
2945 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2947 std::vector<int> tmp;
2948 convertPyToNewIntArr3(li,tmp);
2949 self->setSelectedComponents(a,tmp);
2952 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2954 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2955 std::size_t sz(retCpp.size());
2956 PyObject *res(PyList_New(sz));
2957 for(std::size_t i=0;i<sz;i++)
2958 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2962 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2964 int sz=self->getNumberOfComponents();
2965 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2966 self->getTuple(tupleId,tmp);
2967 return convertIntArrToPyList(tmp,sz);
2970 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2972 DataArrayInt *arr=0;
2973 DataArrayInt *arrI=0;
2974 self->changeSurjectiveFormat(targetNb,arr,arrI);
2975 PyObject *res = PyList_New(2);
2976 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2977 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2981 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2983 std::vector<const DataArrayInt *> tmp;
2984 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2985 return DataArrayInt::Meld(tmp);
2988 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2990 std::vector<const DataArrayInt *> tmp;
2991 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2992 return DataArrayInt::Aggregate(tmp);
2995 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2997 std::vector<const DataArrayInt *> tmp;
2998 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2999 return DataArrayInt::AggregateIndexes(tmp);
3002 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3004 std::vector<const DataArrayInt *> tmp;
3005 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3006 return DataArrayInt::BuildUnion(tmp);
3009 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3011 std::vector<const DataArrayInt *> tmp;
3012 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3013 return DataArrayInt::BuildIntersection(tmp);
3016 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3019 int r1=self->getMaxValue(tmp);
3020 PyObject *ret=PyTuple_New(2);
3021 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3022 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3026 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3029 int r1=self->getMinValue(tmp);
3030 PyObject *ret=PyTuple_New(2);
3031 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3032 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3036 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3038 int nbOfCompo=self->getNumberOfComponents();
3043 if(PyInt_Check(obj))
3045 int val=(int)PyInt_AS_LONG(obj);
3046 return self->findIdFirstEqual(val);
3049 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3053 std::vector<int> arr;
3054 convertPyToNewIntArr3(obj,arr);
3055 return self->findIdFirstEqualTuple(arr);
3060 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3062 int nbOfCompo=self->getNumberOfComponents();
3069 if(PyInt_Check(obj))
3071 int val=(int)PyInt_AS_LONG(obj);
3072 return self->presenceOfValue(val);
3075 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3079 std::vector<int> arr;
3080 convertPyToNewIntArr3(obj,arr);
3081 return self->presenceOfTuple(arr);
3086 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3088 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3089 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3090 self->checkAllocated();
3091 int nbOfTuples=self->getNumberOfTuples();
3092 int nbOfComponents=self->getNumberOfComponents();
3094 std::vector<int> vt1,vc1;
3095 std::pair<int, std::pair<int,int> > pt1,pc1;
3096 DataArrayInt *dt1=0,*dc1=0;
3098 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3099 MCAuto<DataArrayInt> ret;
3104 if(nbOfComponents==1)
3105 return PyInt_FromLong(self->getIJSafe(it1,0));
3106 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3109 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3111 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3113 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3115 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3118 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3119 std::vector<int> v2(1,ic1);
3120 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3124 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3125 std::vector<int> v2(1,ic1);
3126 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3130 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3131 std::vector<int> v2(1,ic1);
3132 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3136 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3137 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3141 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3142 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3146 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3147 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3151 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3152 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3156 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3157 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3158 std::vector<int> v2(nbOfComp);
3159 for(int i=0;i<nbOfComp;i++)
3160 v2[i]=pc1.first+i*pc1.second.second;
3161 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3165 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3166 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3167 std::vector<int> v2(nbOfComp);
3168 for(int i=0;i<nbOfComp;i++)
3169 v2[i]=pc1.first+i*pc1.second.second;
3170 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3174 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3175 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3176 std::vector<int> v2(nbOfComp);
3177 for(int i=0;i<nbOfComp;i++)
3178 v2[i]=pc1.first+i*pc1.second.second;
3179 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3183 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3184 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3185 std::vector<int> v2(nbOfComp);
3186 for(int i=0;i<nbOfComp;i++)
3187 v2[i]=pc1.first+i*pc1.second.second;
3188 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3191 throw INTERP_KERNEL::Exception(msg);
3195 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3197 self->checkAllocated();
3198 const char msg[]="Unexpected situation in __setitem__ !";
3199 int nbOfTuples=self->getNumberOfTuples();
3200 int nbOfComponents=self->getNumberOfComponents();
3203 std::vector<int> v1;
3205 DataArrayIntTuple *dd1=0;
3206 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3208 std::vector<int> vt1,vc1;
3209 std::pair<int, std::pair<int,int> > pt1,pc1;
3210 DataArrayInt *dt1=0,*dc1=0;
3211 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3212 MCAuto<DataArrayInt> tmp;
3220 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3223 tmp=DataArrayInt::New();
3224 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3225 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3228 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3231 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3232 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3235 throw INTERP_KERNEL::Exception(msg);
3244 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3247 tmp=DataArrayInt::New();
3248 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3249 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3252 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3255 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3256 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3259 throw INTERP_KERNEL::Exception(msg);
3268 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3271 tmp=DataArrayInt::New();
3272 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3273 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3276 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3279 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3280 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3283 throw INTERP_KERNEL::Exception(msg);
3292 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3295 tmp=DataArrayInt::New();
3296 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3297 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3300 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3303 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3304 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3307 throw INTERP_KERNEL::Exception(msg);
3316 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3319 tmp=DataArrayInt::New();
3320 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3321 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3324 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3327 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3328 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3331 throw INTERP_KERNEL::Exception(msg);
3340 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3343 tmp=DataArrayInt::New();
3344 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3345 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3348 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3351 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3352 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3355 throw INTERP_KERNEL::Exception(msg);
3364 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3367 tmp=DataArrayInt::New();
3368 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3369 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3372 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3375 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3376 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3379 throw INTERP_KERNEL::Exception(msg);
3388 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3391 tmp=DataArrayInt::New();
3392 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3393 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3396 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3399 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3400 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3403 throw INTERP_KERNEL::Exception(msg);
3412 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3415 tmp=DataArrayInt::New();
3416 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3417 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3420 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3423 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3424 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3427 throw INTERP_KERNEL::Exception(msg);
3436 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3439 tmp=DataArrayInt::New();
3440 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3441 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3444 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3447 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3448 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3451 throw INTERP_KERNEL::Exception(msg);
3460 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3463 tmp=DataArrayInt::New();
3464 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3465 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3468 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3471 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3472 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3475 throw INTERP_KERNEL::Exception(msg);
3484 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3487 tmp=DataArrayInt::New();
3488 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3489 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3492 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3495 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3496 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3499 throw INTERP_KERNEL::Exception(msg);
3508 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3511 tmp=DataArrayInt::New();
3512 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3513 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3516 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3519 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3520 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3523 throw INTERP_KERNEL::Exception(msg);
3532 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3535 tmp=DataArrayInt::New();
3536 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3537 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3540 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3543 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3544 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3547 throw INTERP_KERNEL::Exception(msg);
3556 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3559 tmp=DataArrayInt::New();
3560 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3561 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3564 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3567 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3568 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3571 throw INTERP_KERNEL::Exception(msg);
3580 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3583 tmp=DataArrayInt::New();
3584 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3585 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3588 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3591 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3592 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3595 throw INTERP_KERNEL::Exception(msg);
3600 throw INTERP_KERNEL::Exception(msg);
3605 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3607 return self->negate();
3610 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3612 const char msg[]="Unexpected situation in __add__ !";
3615 std::vector<int> aa;
3616 DataArrayIntTuple *aaa;
3618 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3623 MCAuto<DataArrayInt> ret=self->deepCopy();
3624 ret->applyLin(1,val);
3629 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3630 return DataArrayInt::Add(self,aaaa);
3634 return DataArrayInt::Add(self,a);
3638 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3639 return DataArrayInt::Add(self,aaaa);
3642 throw INTERP_KERNEL::Exception(msg);
3646 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3648 const char msg[]="Unexpected situation in __radd__ !";
3651 std::vector<int> aa;
3652 DataArrayIntTuple *aaa;
3654 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3659 MCAuto<DataArrayInt> ret=self->deepCopy();
3660 ret->applyLin(1,val);
3665 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3666 return DataArrayInt::Add(self,aaaa);
3670 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3671 return DataArrayInt::Add(self,aaaa);
3674 throw INTERP_KERNEL::Exception(msg);
3678 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3680 const char msg[]="Unexpected situation in __iadd__ !";
3683 std::vector<int> aa;
3684 DataArrayIntTuple *aaa;
3686 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3691 self->applyLin(1,val);
3692 Py_XINCREF(trueSelf);
3697 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3699 Py_XINCREF(trueSelf);
3705 Py_XINCREF(trueSelf);
3710 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3711 self->addEqual(aaaa);
3712 Py_XINCREF(trueSelf);
3716 throw INTERP_KERNEL::Exception(msg);
3720 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3722 const char msg[]="Unexpected situation in __sub__ !";
3725 std::vector<int> aa;
3726 DataArrayIntTuple *aaa;
3728 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3733 MCAuto<DataArrayInt> ret=self->deepCopy();
3734 ret->applyLin(1,-val);
3739 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3740 return DataArrayInt::Substract(self,aaaa);
3744 return DataArrayInt::Substract(self,a);
3748 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3749 return DataArrayInt::Substract(self,aaaa);
3752 throw INTERP_KERNEL::Exception(msg);
3756 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3758 const char msg[]="Unexpected situation in __rsub__ !";
3761 std::vector<int> aa;
3762 DataArrayIntTuple *aaa;
3764 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3769 MCAuto<DataArrayInt> ret=self->deepCopy();
3770 ret->applyLin(-1,val);
3775 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3776 return DataArrayInt::Substract(aaaa,self);
3780 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3781 return DataArrayInt::Substract(aaaa,self);
3784 throw INTERP_KERNEL::Exception(msg);
3788 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3790 const char msg[]="Unexpected situation in __isub__ !";
3793 std::vector<int> aa;
3794 DataArrayIntTuple *aaa;
3796 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3801 self->applyLin(1,-val);
3802 Py_XINCREF(trueSelf);
3807 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3808 self->substractEqual(bb);
3809 Py_XINCREF(trueSelf);
3814 self->substractEqual(a);
3815 Py_XINCREF(trueSelf);
3820 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3821 self->substractEqual(aaaa);
3822 Py_XINCREF(trueSelf);
3826 throw INTERP_KERNEL::Exception(msg);
3830 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3832 const char msg[]="Unexpected situation in __mul__ !";
3835 std::vector<int> aa;
3836 DataArrayIntTuple *aaa;
3838 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3843 MCAuto<DataArrayInt> ret=self->deepCopy();
3844 ret->applyLin(val,0);
3849 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3850 return DataArrayInt::Multiply(self,aaaa);
3854 return DataArrayInt::Multiply(self,a);
3858 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3859 return DataArrayInt::Multiply(self,aaaa);
3862 throw INTERP_KERNEL::Exception(msg);
3866 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3868 const char msg[]="Unexpected situation in __rmul__ !";
3871 std::vector<int> aa;
3872 DataArrayIntTuple *aaa;
3874 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3879 MCAuto<DataArrayInt> ret=self->deepCopy();
3880 ret->applyLin(val,0);
3885 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3886 return DataArrayInt::Multiply(self,aaaa);
3890 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3891 return DataArrayInt::Multiply(self,aaaa);
3894 throw INTERP_KERNEL::Exception(msg);
3898 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3900 const char msg[]="Unexpected situation in __imul__ !";
3903 std::vector<int> aa;
3904 DataArrayIntTuple *aaa;
3906 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3911 self->applyLin(val,0);
3912 Py_XINCREF(trueSelf);
3917 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3918 self->multiplyEqual(bb);
3919 Py_XINCREF(trueSelf);
3924 self->multiplyEqual(a);
3925 Py_XINCREF(trueSelf);
3930 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3931 self->multiplyEqual(aaaa);
3932 Py_XINCREF(trueSelf);
3936 throw INTERP_KERNEL::Exception(msg);
3940 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3942 const char msg[]="Unexpected situation in __div__ !";
3945 std::vector<int> aa;
3946 DataArrayIntTuple *aaa;
3948 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3953 MCAuto<DataArrayInt> ret=self->deepCopy();
3954 ret->applyDivideBy(val);
3959 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3960 return DataArrayInt::Divide(self,aaaa);
3964 return DataArrayInt::Divide(self,a);
3968 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3969 return DataArrayInt::Divide(self,aaaa);
3972 throw INTERP_KERNEL::Exception(msg);
3976 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3978 const char msg[]="Unexpected situation in __rdiv__ !";
3981 std::vector<int> aa;
3982 DataArrayIntTuple *aaa;
3984 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3989 MCAuto<DataArrayInt> ret=self->deepCopy();
3995 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3996 return DataArrayInt::Divide(aaaa,self);
4000 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4001 return DataArrayInt::Divide(aaaa,self);
4004 throw INTERP_KERNEL::Exception(msg);
4008 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4010 const char msg[]="Unexpected situation in __idiv__ !";
4013 std::vector<int> aa;
4014 DataArrayIntTuple *aaa;
4016 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4021 self->applyDivideBy(val);
4022 Py_XINCREF(trueSelf);
4027 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4028 self->divideEqual(bb);
4029 Py_XINCREF(trueSelf);
4034 self->divideEqual(a);
4035 Py_XINCREF(trueSelf);
4040 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4041 self->divideEqual(aaaa);
4042 Py_XINCREF(trueSelf);
4046 throw INTERP_KERNEL::Exception(msg);
4050 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4052 const char msg[]="Unexpected situation in __mod__ !";
4055 std::vector<int> aa;
4056 DataArrayIntTuple *aaa;
4058 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4063 MCAuto<DataArrayInt> ret=self->deepCopy();
4064 ret->applyModulus(val);
4069 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4070 return DataArrayInt::Modulus(self,aaaa);
4074 return DataArrayInt::Modulus(self,a);
4078 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4079 return DataArrayInt::Modulus(self,aaaa);
4082 throw INTERP_KERNEL::Exception(msg);
4086 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4088 const char msg[]="Unexpected situation in __rmod__ !";
4091 std::vector<int> aa;
4092 DataArrayIntTuple *aaa;
4094 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4099 MCAuto<DataArrayInt> ret=self->deepCopy();
4100 ret->applyRModulus(val);
4105 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4106 return DataArrayInt::Modulus(aaaa,self);
4110 return DataArrayInt::Modulus(a,self);
4114 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4115 return DataArrayInt::Modulus(aaaa,self);
4118 throw INTERP_KERNEL::Exception(msg);
4122 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4124 const char msg[]="Unexpected situation in __imod__ !";
4127 std::vector<int> aa;
4128 DataArrayIntTuple *aaa;
4130 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4135 self->applyModulus(val);
4136 Py_XINCREF(trueSelf);
4141 self->modulusEqual(a);
4142 Py_XINCREF(trueSelf);
4147 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4148 self->modulusEqual(aaaa);
4149 Py_XINCREF(trueSelf);
4153 throw INTERP_KERNEL::Exception(msg);
4157 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4159 const char msg[]="Unexpected situation in __pow__ !";
4162 std::vector<int> aa;
4163 DataArrayIntTuple *aaa;
4165 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4170 MCAuto<DataArrayInt> ret=self->deepCopy();
4176 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4177 return DataArrayInt::Pow(self,aaaa);
4181 return DataArrayInt::Pow(self,a);
4185 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4186 return DataArrayInt::Pow(self,aaaa);
4189 throw INTERP_KERNEL::Exception(msg);
4193 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4195 const char msg[]="Unexpected situation in __rpow__ !";
4198 std::vector<int> aa;
4199 DataArrayIntTuple *aaa;
4201 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4206 MCAuto<DataArrayInt> ret=self->deepCopy();
4207 ret->applyRPow(val);
4212 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4213 return DataArrayInt::Pow(aaaa,self);
4217 return DataArrayInt::Pow(a,self);
4221 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4222 return DataArrayInt::Pow(aaaa,self);
4225 throw INTERP_KERNEL::Exception(msg);
4229 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4231 const char msg[]="Unexpected situation in __ipow__ !";
4234 std::vector<int> aa;
4235 DataArrayIntTuple *aaa;
4237 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4242 self->applyPow(val);
4243 Py_XINCREF(trueSelf);
4249 Py_XINCREF(trueSelf);
4254 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4255 self->powEqual(aaaa);
4256 Py_XINCREF(trueSelf);
4260 throw INTERP_KERNEL::Exception(msg);
4264 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4266 std::ostringstream oss;
4267 self->reprQuickOverview(oss);
4271 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4273 int szArr,sw,iTypppArr;
4274 std::vector<int> stdvecTyyppArr;
4275 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4276 self->pushBackValsSilent(tmp,tmp+szArr);
4279 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4281 std::vector<int> ret1;
4282 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4283 std::size_t sz=ret0.size();
4284 PyObject *pyRet=PyTuple_New(2);
4285 PyObject *pyRet0=PyList_New((int)sz);
4286 PyObject *pyRet1=PyList_New((int)sz);
4287 for(std::size_t i=0;i<sz;i++)
4289 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4290 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4292 PyTuple_SetItem(pyRet,0,pyRet0);
4293 PyTuple_SetItem(pyRet,1,pyRet1);
4297 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4299 DataArrayInt *ret0=0,*ret1=0;
4300 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4301 PyObject *pyRet=PyTuple_New(2);
4302 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4303 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4307 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4310 bool ret(self->isRange(a,b,c));
4311 PyObject *pyRet=PyTuple_New(2);
4312 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4314 PyTuple_SetItem(pyRet,0,ret0Py);
4316 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4322 PyTuple_SetItem(pyRet,1,ret1Py);
4327 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4329 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4332 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4335 if(!self->isAllocated())
4336 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4337 PyObject *ret(PyTuple_New(1));
4338 PyObject *ret0(PyDict_New());
4339 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4340 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4341 PyObject *tmp1(PyInt_FromLong(0));
4342 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4343 PyTuple_SetItem(ret,0,ret0);
4347 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4353 class DataArrayIntTuple;
4355 class DataArrayIntIterator
4358 DataArrayIntIterator(DataArrayInt *da);
4359 ~DataArrayIntIterator();
4364 DataArrayIntTuple *ret=self->nextt();
4366 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4369 PyErr_SetString(PyExc_StopIteration,"No more data.");
4376 class DataArrayIntTuple
4379 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4380 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4383 std::string __str__() const throw(INTERP_KERNEL::Exception)
4385 return self->repr();
4388 int __int__() const throw(INTERP_KERNEL::Exception)
4390 return self->intValue();
4393 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4395 return self->buildDAInt(1,self->getNumberOfCompo());
4398 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4400 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4401 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4402 Py_XINCREF(trueSelf);
4406 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4408 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4409 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4410 Py_XINCREF(trueSelf);
4414 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4416 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4417 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4418 Py_XINCREF(trueSelf);
4422 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4424 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4425 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4426 Py_XINCREF(trueSelf);
4430 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4432 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4433 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4434 Py_XINCREF(trueSelf);
4438 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4440 return PyInt_FromLong(self->getNumberOfCompo());
4443 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4445 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4448 std::vector<int> multiVal;
4449 std::pair<int, std::pair<int,int> > slic;
4450 MEDCoupling::DataArrayInt *daIntTyypp=0;
4451 const int *pt=self->getConstPointer();
4452 int nbc=self->getNumberOfCompo();
4453 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4460 std::ostringstream oss;
4461 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4462 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4466 return PyInt_FromLong(pt[singleVal]);
4470 return PyInt_FromLong(pt[nbc+singleVal]);
4473 std::ostringstream oss;
4474 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4475 throw INTERP_KERNEL::Exception(oss.str().c_str());
4481 PyObject *t=PyTuple_New(multiVal.size());
4482 for(int j=0;j<(int)multiVal.size();j++)
4484 int cid=multiVal[j];
4487 std::ostringstream oss;
4488 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4489 throw INTERP_KERNEL::Exception(oss.str().c_str());
4491 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4497 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4498 PyObject *t=PyTuple_New(sz);
4499 for(int j=0;j<sz;j++)
4500 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4504 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4508 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4510 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4511 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4514 std::vector<int> multiValV;
4515 std::pair<int, std::pair<int,int> > slicV;
4516 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4517 int nbc=self->getNumberOfCompo();
4518 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4520 std::vector<int> multiVal;
4521 std::pair<int, std::pair<int,int> > slic;
4522 MEDCoupling::DataArrayInt *daIntTyypp=0;
4523 int *pt=self->getPointer();
4524 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4531 std::ostringstream oss;
4532 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4533 throw INTERP_KERNEL::Exception(oss.str().c_str());
4539 pt[singleVal]=singleValV;
4544 if(multiValV.size()!=1)
4546 std::ostringstream oss;
4547 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4548 throw INTERP_KERNEL::Exception(oss.str().c_str());
4550 pt[singleVal]=multiValV[0];
4555 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4559 throw INTERP_KERNEL::Exception(msg);
4568 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4572 std::ostringstream oss;
4573 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4574 throw INTERP_KERNEL::Exception(oss.str().c_str());
4582 if(multiVal.size()!=multiValV.size())
4584 std::ostringstream oss;
4585 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4586 throw INTERP_KERNEL::Exception(oss.str().c_str());
4588 for(int i=0;i<(int)multiVal.size();i++)
4590 int pos=multiVal[i];
4593 std::ostringstream oss;
4594 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4595 throw INTERP_KERNEL::Exception(oss.str().c_str());
4597 pt[multiVal[i]]=multiValV[i];
4603 const int *ptV=daIntTyyppV->getConstPointer();
4604 if(nbc>daIntTyyppV->getNumberOfCompo())
4606 std::ostringstream oss;
4607 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4608 throw INTERP_KERNEL::Exception(oss.str().c_str());
4610 std::copy(ptV,ptV+nbc,pt);
4614 throw INTERP_KERNEL::Exception(msg);
4619 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4624 for(int j=0;j<sz;j++)
4625 pt[slic.first+j*slic.second.second]=singleValV;
4630 if(sz!=(int)multiValV.size())
4632 std::ostringstream oss;
4633 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4634 throw INTERP_KERNEL::Exception(oss.str().c_str());
4636 for(int j=0;j<sz;j++)
4637 pt[slic.first+j*slic.second.second]=multiValV[j];
4642 const int *ptV=daIntTyyppV->getConstPointer();
4643 if(sz>daIntTyyppV->getNumberOfCompo())
4645 std::ostringstream oss;
4646 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4647 throw INTERP_KERNEL::Exception(oss.str().c_str());
4649 for(int j=0;j<sz;j++)
4650 pt[slic.first+j*slic.second.second]=ptV[j];
4654 throw INTERP_KERNEL::Exception(msg);
4658 throw INTERP_KERNEL::Exception(msg);
4664 class DataArrayChar : public DataArray
4667 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4668 int getHashCode() const throw(INTERP_KERNEL::Exception);
4669 bool empty() const throw(INTERP_KERNEL::Exception);
4670 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4671 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4672 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4673 char popBackSilent() throw(INTERP_KERNEL::Exception);
4674 void pack() const throw(INTERP_KERNEL::Exception);
4675 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4676 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4677 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4678 void reverse() throw(INTERP_KERNEL::Exception);
4679 void fillWithZero() throw(INTERP_KERNEL::Exception);
4680 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4681 std::string repr() const throw(INTERP_KERNEL::Exception);
4682 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4683 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4684 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4685 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4686 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4687 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4688 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4689 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4690 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4691 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4692 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4693 char front() const throw(INTERP_KERNEL::Exception);
4694 char back() const throw(INTERP_KERNEL::Exception);
4695 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4696 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4697 char *getPointer() throw(INTERP_KERNEL::Exception);
4698 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4699 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4700 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4701 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4702 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4703 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4704 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4705 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4706 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4707 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4708 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4711 int __len__() const throw(INTERP_KERNEL::Exception)
4713 if(self->isAllocated())
4715 return self->getNumberOfTuples();
4719 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4723 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4726 bool ret0=self->isEqualIfNotWhy(other,ret1);
4727 PyObject *ret=PyTuple_New(2);
4728 PyObject *ret0Py=ret0?Py_True:Py_False;
4730 PyTuple_SetItem(ret,0,ret0Py);
4731 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4735 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4738 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4739 if (!SWIG_IsOK(res1))
4742 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4743 if(size!=self->getNumberOfTuples())
4745 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4747 return self->renumber(tmp);
4751 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4753 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4754 da2->checkAllocated();
4755 int size=self->getNumberOfTuples();
4756 if(size!=self->getNumberOfTuples())
4758 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4760 return self->renumber(da2->getConstPointer());
4764 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4767 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4768 if (!SWIG_IsOK(res1))
4771 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4772 if(size!=self->getNumberOfTuples())
4774 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4776 return self->renumberR(tmp);
4780 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4782 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4783 da2->checkAllocated();
4784 int size=self->getNumberOfTuples();
4785 if(size!=self->getNumberOfTuples())
4787 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4789 return self->renumberR(da2->getConstPointer());
4793 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4796 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4797 if (!SWIG_IsOK(res1))
4800 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4801 if(size!=self->getNumberOfTuples())
4803 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4805 return self->renumberAndReduce(tmp,newNbOfTuple);
4809 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4811 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4812 da2->checkAllocated();
4813 int size=self->getNumberOfTuples();
4814 if(size!=self->getNumberOfTuples())
4816 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4818 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4822 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4824 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4825 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4826 return DataArrayChar::Aggregate(tmp);
4829 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4831 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4832 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4833 return DataArrayChar::Meld(tmp);
4838 class DataArrayByteIterator;
4840 class DataArrayByte : public DataArrayChar
4843 static DataArrayByte *New();
4844 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4845 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4846 char byteValue() const throw(INTERP_KERNEL::Exception);
4849 DataArrayByte() throw(INTERP_KERNEL::Exception)
4851 return DataArrayByte::New();
4854 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4856 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) !";
4857 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4861 if(PyInt_Check(nbOfTuples))
4863 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4865 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4868 if(PyInt_Check(nbOfComp))
4869 {//DataArrayByte.New([1,3,4,5],2,2)
4870 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4872 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4873 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4874 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4875 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4879 throw INTERP_KERNEL::Exception(msg);
4882 {//DataArrayByte.New([1,3,4],3)
4883 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4885 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4886 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4891 throw INTERP_KERNEL::Exception(msg);
4894 {// DataArrayByte.New([1,3,4])
4895 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4896 int tmpp1=-1,tmpp2=-1;
4897 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4898 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4902 else if(PyInt_Check(elt0))
4904 int nbOfTuples1=PyInt_AS_LONG(elt0);
4906 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4911 if(PyInt_Check(nbOfTuples))
4912 {//DataArrayByte.New(5,2)
4913 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4915 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4916 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4917 ret->alloc(nbOfTuples1,nbOfCompo);
4921 throw INTERP_KERNEL::Exception(msg);
4924 throw INTERP_KERNEL::Exception(msg);
4927 {//DataArrayByte.New(5)
4928 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4929 ret->alloc(nbOfTuples1,1);
4934 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4935 {//DataArrayDouble.New(numpyArray)
4936 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4940 throw INTERP_KERNEL::Exception(msg);
4943 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4945 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4948 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4950 std::ostringstream oss;
4951 self->reprQuickOverview(oss);
4955 int __int__() const throw(INTERP_KERNEL::Exception)
4957 return (int) self->byteValue();
4960 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4962 return self->iterator();
4965 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4967 return (int)self->getIJ(tupleId,compoId);
4970 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4972 return (int)self->getIJSafe(tupleId,compoId);
4975 std::string __str__() const throw(INTERP_KERNEL::Exception)
4977 return self->repr();
4980 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4982 const char *vals=self->getConstPointer();
4983 int nbOfComp=self->getNumberOfComponents();
4984 int nbOfTuples=self->getNumberOfTuples();
4985 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4988 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4991 int ival=-1; std::vector<int> ivval;
4992 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4993 std::vector<char> vals(sz);
4994 std::copy(pt,pt+sz,vals.begin());
4995 return self->presenceOfTuple(vals);
4998 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5001 int ival=-1; std::vector<int> ivval;
5002 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
5003 std::vector<char> vals2(sz);
5004 std::copy(pt,pt+sz,vals2.begin());
5005 return self->presenceOfValue(vals2);
5008 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5011 int ival=-1; std::vector<int> ivval;
5012 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
5013 std::vector<char> vals2(sz);
5014 std::copy(pt,pt+sz,vals2.begin());
5015 return self->findIdFirstEqual(vals2);
5018 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5021 int ival=-1; std::vector<int> ivval;
5022 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
5023 std::vector<char> vals(sz);
5024 std::copy(pt,pt+sz,vals.begin());
5025 return self->findIdFirstEqualTuple(vals);
5028 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5031 int ival=-1; std::vector<int> ivval;
5032 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
5033 std::vector<char> vals(sz);
5034 std::copy(pt,pt+sz,vals.begin());
5035 return self->findIdSequence(vals);
5038 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5040 int sz=self->getNumberOfComponents();
5041 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5042 self->getTuple(tupleId,tmp);
5043 PyObject *ret=PyTuple_New(sz);
5044 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5048 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5051 int r1=(int)self->getMaxValue(tmp);
5052 PyObject *ret=PyTuple_New(2);
5053 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5054 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5058 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5061 int r1=(int)self->getMinValue(tmp);
5062 PyObject *ret=PyTuple_New(2);
5063 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5064 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5068 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5070 int nbOfCompo=self->getNumberOfComponents();
5075 if(PyInt_Check(obj))
5077 int val=(int)PyInt_AS_LONG(obj);
5078 return self->findIdFirstEqual(val);
5081 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5084 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5088 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5090 int nbOfCompo=self->getNumberOfComponents();
5097 if(PyInt_Check(obj))
5099 int val=(int)PyInt_AS_LONG(obj);
5100 return self->presenceOfValue(val);
5103 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5106 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5111 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5113 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5118 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5120 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5123 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5126 if(!self->isAllocated())
5127 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5128 PyObject *ret(PyTuple_New(1));
5129 PyObject *ret0(PyDict_New());
5130 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5131 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5132 PyObject *tmp1(PyInt_FromLong(0));
5133 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5134 PyTuple_SetItem(ret,0,ret0);
5138 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5142 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5144 self->checkAllocated();
5145 const char msg[]="Unexpected situation in __setitem__ !";
5146 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5149 std::vector<int> v1;
5151 DataArrayIntTuple *dd1=0;
5152 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5154 std::vector<int> vt1,vc1;
5155 std::pair<int, std::pair<int,int> > pt1,pc1;
5156 DataArrayInt *dt1=0,*dc1=0;
5157 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5158 MCAuto<DataArrayInt> tmp;
5166 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5169 throw INTERP_KERNEL::Exception(msg);
5178 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5181 throw INTERP_KERNEL::Exception(msg);
5190 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5193 throw INTERP_KERNEL::Exception(msg);
5202 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5205 throw INTERP_KERNEL::Exception(msg);
5214 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5217 throw INTERP_KERNEL::Exception(msg);
5226 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5229 throw INTERP_KERNEL::Exception(msg);
5238 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5241 throw INTERP_KERNEL::Exception(msg);
5250 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5253 throw INTERP_KERNEL::Exception(msg);
5262 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5265 throw INTERP_KERNEL::Exception(msg);
5274 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5277 throw INTERP_KERNEL::Exception(msg);
5286 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5289 throw INTERP_KERNEL::Exception(msg);
5298 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5301 throw INTERP_KERNEL::Exception(msg);
5310 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5313 throw INTERP_KERNEL::Exception(msg);
5322 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5325 throw INTERP_KERNEL::Exception(msg);
5334 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5337 throw INTERP_KERNEL::Exception(msg);
5346 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5349 throw INTERP_KERNEL::Exception(msg);
5354 throw INTERP_KERNEL::Exception(msg);
5361 class DataArrayByteTuple;
5363 class DataArrayByteIterator
5366 DataArrayByteIterator(DataArrayByte *da);
5367 ~DataArrayByteIterator();
5370 class DataArrayByteTuple
5373 std::string repr() const throw(INTERP_KERNEL::Exception);
5374 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5377 std::string __str__() const throw(INTERP_KERNEL::Exception)
5379 return self->repr();
5382 char __int__() const throw(INTERP_KERNEL::Exception)
5384 return self->byteValue();
5387 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5389 return self->buildDAByte(1,self->getNumberOfCompo());
5394 class DataArrayAsciiCharIterator;
5396 class DataArrayAsciiChar : public DataArrayChar
5399 static DataArrayAsciiChar *New();
5400 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5401 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5402 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5405 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5407 return DataArrayAsciiChar::New();
5410 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5412 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) !";
5413 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5417 if(PyInt_Check(nbOfTuples))
5419 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5421 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5424 if(PyInt_Check(nbOfComp))
5425 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5426 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5428 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5429 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5430 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5431 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5435 throw INTERP_KERNEL::Exception(msg);
5438 {//DataArrayAsciiChar.New([1,3,4],3)
5439 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5441 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5442 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5446 else if(PyString_Check(nbOfTuples))
5448 if(PyString_Size(nbOfTuples)!=1)
5449 throw INTERP_KERNEL::Exception(msg);
5450 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5451 std::vector<std::string> tmp;
5452 if(fillStringVector(elt0,tmp))
5453 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5455 throw INTERP_KERNEL::Exception(msg);
5458 throw INTERP_KERNEL::Exception(msg);
5462 std::vector<std::string> tmmp;
5463 if(fillStringVector(elt0,tmmp))
5464 //DataArrayAsciiChar.New(["abc","de","fghi"])
5465 return DataArrayAsciiChar::New(tmmp,' ');
5468 // DataArrayAsciiChar.New([1,3,4])
5469 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5470 int tmpp1=-1,tmpp2=-1;
5471 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5472 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5477 else if(PyInt_Check(elt0))
5479 int nbOfTuples1=PyInt_AS_LONG(elt0);
5481 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5486 if(PyInt_Check(nbOfTuples))
5487 {//DataArrayAsciiChar.New(5,2)
5488 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5490 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5491 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5492 ret->alloc(nbOfTuples1,nbOfCompo);
5496 throw INTERP_KERNEL::Exception(msg);
5499 throw INTERP_KERNEL::Exception(msg);
5502 {//DataArrayAsciiChar.New(5)
5503 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5504 ret->alloc(nbOfTuples1,1);
5509 throw INTERP_KERNEL::Exception(msg);
5512 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5514 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5517 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5519 std::ostringstream oss;
5520 self->reprQuickOverview(oss);
5524 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5526 return self->iterator();
5529 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5531 char tmp[2]; tmp[1]='\0';
5532 tmp[0]=self->getIJ(tupleId,compoId);
5533 return std::string(tmp);
5536 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5538 char tmp[2]; tmp[1]='\0';
5539 tmp[0]=self->getIJSafe(tupleId,compoId);
5540 return std::string(tmp);
5543 std::string __str__() const throw(INTERP_KERNEL::Exception)
5545 return self->repr();
5548 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5550 const char *vals=self->getConstPointer();
5551 int nbOfComp=self->getNumberOfComponents();
5552 int nbOfTuples=self->getNumberOfTuples();
5553 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5556 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5558 if(PyString_Check(tupl))
5560 Py_ssize_t sz=PyString_Size(tupl);
5561 std::vector<char> vals(sz);
5562 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5563 return self->presenceOfTuple(vals);
5566 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5569 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5571 if(PyString_Check(vals))
5573 Py_ssize_t sz=PyString_Size(vals);
5574 std::vector<char> vals2(sz);
5575 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5576 return self->presenceOfValue(vals2);
5579 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5582 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5584 if(PyString_Check(vals))
5586 Py_ssize_t sz=PyString_Size(vals);
5587 std::vector<char> vals2(sz);
5588 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5589 return self->findIdFirstEqual(vals2);
5592 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5595 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5597 if(PyString_Check(tupl))
5599 Py_ssize_t sz=PyString_Size(tupl);
5600 std::vector<char> vals(sz);
5601 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5602 return self->findIdFirstEqualTuple(vals);
5605 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5608 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5610 if(PyString_Check(strOrListOfInt))
5612 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5613 std::vector<char> vals(sz);
5614 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5615 return self->findIdSequence(vals);
5618 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5621 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5623 int sz=self->getNumberOfComponents();
5624 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5625 self->getTuple(tupleId,tmp);
5626 return PyString_FromString(tmp);
5629 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5632 char tmp2[2]; tmp2[1]='\0';
5633 tmp2[0]=self->getMaxValue(tmp);
5634 PyObject *ret=PyTuple_New(2);
5635 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5636 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5640 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5643 char tmp2[2]; tmp2[1]='\0';
5644 tmp2[0]=self->getMinValue(tmp);
5645 PyObject *ret=PyTuple_New(2);
5646 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5647 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5651 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5653 int nbOfCompo=self->getNumberOfComponents();
5658 if(PyString_Check(obj))
5660 Py_ssize_t sz=PyString_Size(obj);
5661 char *pt=PyString_AsString(obj);
5663 return self->findIdFirstEqual(pt[0]);
5665 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5668 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5671 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5675 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5677 int nbOfCompo=self->getNumberOfComponents();
5684 if(PyString_Check(obj))
5686 Py_ssize_t sz=PyString_Size(obj);
5687 char *pt=PyString_AsString(obj);
5689 return self->presenceOfValue(pt[0]);
5691 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5694 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5697 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5701 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5704 std::vector<int> stdvecTyyppArr;
5705 std::pair<int, std::pair<int,int> > sTyyppArr;
5706 MEDCoupling::DataArrayInt *daIntTyypp=0;
5707 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5711 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5713 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5715 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5717 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5719 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5723 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5725 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.";
5727 std::vector<int> stdvecTyyppArr;
5728 std::pair<int, std::pair<int,int> > sTyyppArr;
5729 MEDCoupling::DataArrayInt *daIntTyypp=0;
5730 int nbOfCompo=self->getNumberOfComponents();
5731 int nbOfTuples=self->getNumberOfTuples();
5732 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5734 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5735 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5744 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5750 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5751 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5754 //value vector<string>
5757 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5758 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5761 //value DataArrayChar
5764 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5768 throw INTERP_KERNEL::Exception(msg);
5772 {//obj list-tuple[int]
5778 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5784 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5785 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5788 //value vector<string>
5791 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5792 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5795 //value DataArrayChar
5798 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5802 throw INTERP_KERNEL::Exception(msg);
5813 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5819 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5820 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5823 //value vector<string>
5826 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5827 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5830 //value DataArrayChar
5833 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5837 throw INTERP_KERNEL::Exception(msg);
5848 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5854 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5855 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5858 //value vector<string>
5861 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5862 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5865 //value DataArrayChar
5868 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5872 throw INTERP_KERNEL::Exception(msg);
5877 throw INTERP_KERNEL::Exception(msg);
5883 class DataArrayAsciiCharTuple;
5885 class DataArrayAsciiCharIterator
5888 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5889 ~DataArrayAsciiCharIterator();
5894 DataArrayAsciiCharTuple *ret=self->nextt();
5896 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5899 PyErr_SetString(PyExc_StopIteration,"No more data.");
5906 class DataArrayAsciiCharTuple
5909 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5910 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5913 std::string __str__() const throw(INTERP_KERNEL::Exception)
5915 return self->repr();
5918 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5920 return self->buildDAAsciiChar(1,self->getNumberOfCompo());