1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
22 %typemap(out) MEDCoupling::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) MEDCoupling::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
44 %typemap(out) MCAuto<MEDCoupling::DataArrayInt>
46 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN|0);
49 %typemap(out) MCAuto<MEDCoupling::DataArrayDouble>
51 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN|0);
54 %typemap(out) MCAuto<MEDCoupling::DataArrayFloat>
56 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayFloat,SWIG_POINTER_OWN|0);
60 %newobject MEDCoupling::DataArray::deepCopy;
61 %newobject MEDCoupling::DataArray::buildNewEmptyInstance;
62 %newobject MEDCoupling::DataArray::selectByTupleRanges;
63 %newobject MEDCoupling::DataArray::selectByTupleId;
64 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
65 %newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
66 %newobject MEDCoupling::DataArray::Aggregate;
67 %newobject MEDCoupling::DataArrayFloat::New;
68 %newobject MEDCoupling::DataArrayFloat::iterator;
69 %newobject MEDCoupling::DataArrayFloat::__iter__;
70 %newobject MEDCoupling::DataArrayInt::New;
71 %newobject MEDCoupling::DataArrayInt::__iter__;
72 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
73 %newobject MEDCoupling::DataArrayInt::subArray;
74 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
75 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
76 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
77 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
78 %newobject MEDCoupling::DataArrayInt::renumber;
79 %newobject MEDCoupling::DataArrayInt::renumberR;
80 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
81 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
82 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
83 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
84 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
85 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
86 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
87 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
88 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
89 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
90 %newobject MEDCoupling::DataArrayInt::negate;
91 %newobject MEDCoupling::DataArrayInt::computeAbs;
92 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
93 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
94 %newobject MEDCoupling::DataArrayInt::findIdsStrictlyNegative;
95 %newobject MEDCoupling::DataArrayInt::Aggregate;
96 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
97 %newobject MEDCoupling::DataArrayInt::Meld;
98 %newobject MEDCoupling::DataArrayInt::Add;
99 %newobject MEDCoupling::DataArrayInt::Substract;
100 %newobject MEDCoupling::DataArrayInt::Multiply;
101 %newobject MEDCoupling::DataArrayInt::Divide;
102 %newobject MEDCoupling::DataArrayInt::Pow;
103 %newobject MEDCoupling::DataArrayInt::BuildUnion;
104 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
105 %newobject MEDCoupling::DataArrayInt::Range;
106 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
107 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
108 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
109 %newobject MEDCoupling::DataArrayInt::buildComplement;
110 %newobject MEDCoupling::DataArrayInt::buildUnion;
111 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
112 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
113 %newobject MEDCoupling::DataArrayInt::buildIntersection;
114 %newobject MEDCoupling::DataArrayInt::buildUnique;
115 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
116 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
117 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
118 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
119 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
120 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
121 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
122 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
123 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
124 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
125 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
126 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
127 %newobject MEDCoupling::DataArrayInt::__neg__;
128 %newobject MEDCoupling::DataArrayInt::__add__;
129 %newobject MEDCoupling::DataArrayInt::__radd__;
130 %newobject MEDCoupling::DataArrayInt::__sub__;
131 %newobject MEDCoupling::DataArrayInt::__rsub__;
132 %newobject MEDCoupling::DataArrayInt::__mul__;
133 %newobject MEDCoupling::DataArrayInt::__rmul__;
134 %newobject MEDCoupling::DataArrayInt::__div__;
135 %newobject MEDCoupling::DataArrayInt::__rdiv__;
136 %newobject MEDCoupling::DataArrayInt::__mod__;
137 %newobject MEDCoupling::DataArrayInt::__rmod__;
138 %newobject MEDCoupling::DataArrayInt::__pow__;
139 %newobject MEDCoupling::DataArrayInt::__rpow__;
140 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
141 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
142 %newobject MEDCoupling::DataArrayChar::renumber;
143 %newobject MEDCoupling::DataArrayChar::renumberR;
144 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
145 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
146 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
147 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
148 %newobject MEDCoupling::DataArrayChar::Aggregate;
149 %newobject MEDCoupling::DataArrayChar::Meld;
150 %newobject MEDCoupling::DataArrayByte::New;
151 %newobject MEDCoupling::DataArrayByte::__iter__;
152 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
153 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
154 %newobject MEDCoupling::DataArrayChar::subArray;
155 %newobject MEDCoupling::DataArrayAsciiChar::New;
156 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
157 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
158 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
159 %newobject MEDCoupling::DataArrayDouble::New;
160 %newobject MEDCoupling::DataArrayDouble::__iter__;
161 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
162 %newobject MEDCoupling::DataArrayDouble::Aggregate;
163 %newobject MEDCoupling::DataArrayDouble::Meld;
164 %newobject MEDCoupling::DataArrayDouble::Dot;
165 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
166 %newobject MEDCoupling::DataArrayDouble::Add;
167 %newobject MEDCoupling::DataArrayDouble::Substract;
168 %newobject MEDCoupling::DataArrayDouble::Multiply;
169 %newobject MEDCoupling::DataArrayDouble::Divide;
170 %newobject MEDCoupling::DataArrayDouble::Pow;
171 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
172 %newobject MEDCoupling::DataArrayDouble::subArray;
173 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
174 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
175 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
176 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
177 %newobject MEDCoupling::DataArrayDouble::findIdsStrictlyNegative;
178 %newobject MEDCoupling::DataArrayDouble::negate;
179 %newobject MEDCoupling::DataArrayDouble::computeAbs;
180 %newobject MEDCoupling::DataArrayDouble::applyFunc;
181 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
182 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
183 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
184 %newobject MEDCoupling::DataArrayDouble::determinant;
185 %newobject MEDCoupling::DataArrayDouble::eigenValues;
186 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
187 %newobject MEDCoupling::DataArrayDouble::inverse;
188 %newobject MEDCoupling::DataArrayDouble::trace;
189 %newobject MEDCoupling::DataArrayDouble::deviator;
190 %newobject MEDCoupling::DataArrayDouble::magnitude;
191 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
192 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
193 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
194 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
195 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
196 %newobject MEDCoupling::DataArrayDouble::renumber;
197 %newobject MEDCoupling::DataArrayDouble::renumberR;
198 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
199 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
200 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
201 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
202 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
203 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
204 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
205 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
206 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
207 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
208 %newobject MEDCoupling::DataArrayDouble::cartesianize;
209 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
210 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
211 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
212 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
213 %newobject MEDCoupling::DataArrayDouble::__neg__;
214 %newobject MEDCoupling::DataArrayDouble::__radd__;
215 %newobject MEDCoupling::DataArrayDouble::__rsub__;
216 %newobject MEDCoupling::DataArrayDouble::__rmul__;
217 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
218 %newobject MEDCoupling::DataArrayDouble::__pow__;
219 %newobject MEDCoupling::DataArrayDouble::__rpow__;
220 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
222 %newobject MEDCoupling::PartDefinition::New;
223 %newobject MEDCoupling::PartDefinition::toDAI;
224 %newobject MEDCoupling::PartDefinition::__add__;
225 %newobject MEDCoupling::PartDefinition::composeWith;
226 %newobject MEDCoupling::PartDefinition::tryToSimplify;
227 %newobject MEDCoupling::DataArrayPartDefinition::New;
228 %newobject MEDCoupling::SlicePartDefinition::New;
231 %feature("unref") DataArray "$this->decrRef();"
232 %feature("unref") DataArrayDouble "$this->decrRef();"
233 %feature("unref") DataArrayInt "$this->decrRef();"
234 %feature("unref") DataArrayChar "$this->decrRef();"
235 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
236 %feature("unref") DataArrayByte "$this->decrRef();"
238 %feature("unref") PartDefinition "$this->decrRef();"
239 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
240 %feature("unref") SlicePartDefinition "$this->decrRef();"
242 namespace MEDCoupling
249 } MEDCouplingAxisType;
253 class PartDefinition : public RefCountObject, public TimeLabel
256 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
257 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
258 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
259 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
260 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
261 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
262 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
263 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
266 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
268 return (*self)+other;
271 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
274 bool ret0(self->isEqual(other,ret1));
275 PyObject *ret=PyTuple_New(2);
276 PyObject *ret0Py=ret0?Py_True:Py_False;
278 PyTuple_SetItem(ret,0,ret0Py);
279 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
283 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
285 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
289 virtual ~PartDefinition();
292 class DataArrayPartDefinition : public PartDefinition
295 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
298 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
300 return DataArrayPartDefinition::New(listOfIds);
303 std::string __str__() const throw(INTERP_KERNEL::Exception)
305 return self->getRepr();
308 std::string __repr__() const throw(INTERP_KERNEL::Exception)
310 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
311 oss << self->getRepr();
316 virtual ~DataArrayPartDefinition();
319 class SlicePartDefinition : public PartDefinition
322 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
323 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
326 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
328 return SlicePartDefinition::New(start,stop,step);
331 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
334 self->getSlice(a,b,c);
335 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
338 std::string __str__() const throw(INTERP_KERNEL::Exception)
340 return self->getRepr();
343 std::string __repr__() const throw(INTERP_KERNEL::Exception)
345 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
346 oss << self->getRepr();
351 virtual ~SlicePartDefinition();
354 class DataArray : public RefCountObject, public TimeLabel
357 void setName(const std::string& name);
358 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
359 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
360 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
361 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
362 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
363 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
364 std::string getName() const;
365 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
366 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
367 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
368 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
369 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
370 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
371 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
372 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
373 int getNumberOfComponents() const;
374 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
375 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
376 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
377 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
378 virtual void desallocate() throw(INTERP_KERNEL::Exception);
379 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
380 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
381 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
382 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
383 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
384 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
385 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
386 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
387 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
388 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
389 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
390 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
391 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
392 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
393 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
394 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
395 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
396 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
397 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
398 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
399 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
400 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
401 void updateTime() const;
404 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
406 const std::vector<std::string>& comps=self->getInfoOnComponents();
407 PyObject *ret=PyList_New((int)comps.size());
408 for(int i=0;i<(int)comps.size();i++)
409 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
413 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
415 std::vector<int> tmp;
416 convertPyToNewIntArr3(li,tmp);
417 self->copyPartOfStringInfoFrom(other,tmp);
420 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
422 std::vector<int> tmp;
423 convertPyToNewIntArr3(li,tmp);
424 self->copyPartOfStringInfoFrom2(tmp,other);
427 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
430 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
431 if (!SWIG_IsOK(res1))
434 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
435 if(size!=self->getNumberOfTuples())
437 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
439 self->renumberInPlace(tmp);
443 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
445 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
446 da2->checkAllocated();
447 int size=self->getNumberOfTuples();
448 if(size!=self->getNumberOfTuples())
450 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
452 self->renumberInPlace(da2->getConstPointer());
456 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
459 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
460 if (!SWIG_IsOK(res1))
463 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
464 if(size!=self->getNumberOfTuples())
466 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
468 self->renumberInPlaceR(tmp);
472 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
474 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
475 da2->checkAllocated();
476 int size=self->getNumberOfTuples();
477 if(size!=self->getNumberOfTuples())
479 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
481 self->renumberInPlaceR(da2->getConstPointer());
485 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
486 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
488 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
489 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
490 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
491 DataArrayInt *tuplesSelecPtr2=0;
494 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
496 throw INTERP_KERNEL::Exception(msg);
498 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
501 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
503 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
504 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
507 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
509 std::vector<std::pair<int,int> > ranges;
510 convertPyToVectorPairInt(li,ranges);
511 return self->selectByTupleRanges(ranges);
514 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
517 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
518 if (!SWIG_IsOK(res1))
521 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
522 return self->selectByTupleId(tmp,tmp+size);
526 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
528 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
529 da2->checkAllocated();
530 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
534 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
537 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
538 if (!SWIG_IsOK(res1))
541 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
542 return self->selectByTupleIdSafe(tmp,tmp+size);
546 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
548 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
549 da2->checkAllocated();
550 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
554 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
556 std::vector<int> tmp;
557 convertPyToNewIntArr3(li,tmp);
558 DataArray *ret=self->keepSelectedComponents(tmp);
559 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
562 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
564 if(!PySlice_Check(slic))
565 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
566 Py_ssize_t strt=2,stp=2,step=2;
567 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
568 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
570 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
571 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
574 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
576 if(!PySlice_Check(slic))
577 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
578 Py_ssize_t strt=2,stp=2,step=2;
579 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
580 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
582 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
583 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
586 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
588 if(!PySlice_Check(slic))
589 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
590 Py_ssize_t strt=2,stp=2,step=2;
591 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
592 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
593 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
596 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
598 if(!PySlice_Check(slic))
599 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
600 Py_ssize_t strt=2,stp=2,step=2;
601 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
602 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
603 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
606 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
608 std::vector<const DataArray *> tmp;
609 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
610 return DataArray::Aggregate(tmp);
613 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
615 if(!PySlice_Check(slic))
616 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
617 Py_ssize_t strt=2,stp=2,step=2;
618 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
619 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
620 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
623 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
625 if(!PySlice_Check(slic))
626 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
627 Py_ssize_t strt=2,stp=2,step=2;
628 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
629 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
630 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
633 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
635 PyObject *ret(PyTuple_New(2));
636 std::string a0(self->getName());
637 const std::vector<std::string> &a1(self->getInfoOnComponents());
638 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
641 PyObject *ret1(PyList_New(sz));
642 for(int i=0;i<sz;i++)
643 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
644 PyTuple_SetItem(ret,1,ret1);
649 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
651 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 !";
652 if(!PyTuple_Check(inp))
653 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
654 int sz(PyTuple_Size(inp));
656 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
657 PyObject *a0(PyTuple_GetItem(inp,0));
658 if(!PyString_Check(a0))
659 throw INTERP_KERNEL::Exception(MSG);
660 PyObject *a1(PyTuple_GetItem(inp,1));
661 std::vector<std::string> a1cpp;
662 if(!fillStringVector(a1,a1cpp))
663 throw INTERP_KERNEL::Exception(MSG);
664 self->setName(PyString_AsString(a0));
665 self->setInfoOnComponents(a1cpp);
670 class DataArrayDouble;
672 class DataArrayFloat : public DataArray
675 static DataArrayFloat *New();
676 void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
677 bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
678 bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
679 bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
680 void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
681 void iota(float init=0.) throw(INTERP_KERNEL::Exception);
682 DataArrayFloatIterator *iterator() throw(INTERP_KERNEL::Exception);
683 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
686 DataArrayFloat() throw(INTERP_KERNEL::Exception)
688 return DataArrayFloat::New();
691 static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
693 return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
696 DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
698 return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
701 DataArrayFloatIterator *__iter__() throw(INTERP_KERNEL::Exception)
703 return self->iterator();
706 std::string __repr__() const throw(INTERP_KERNEL::Exception)
708 std::ostringstream oss;
709 self->reprQuickOverview(oss);
713 std::string __str__() const throw(INTERP_KERNEL::Exception)
715 return self->reprNotTooLong();
718 int __len__() const throw(INTERP_KERNEL::Exception)
720 if(self->isAllocated())
722 return self->getNumberOfTuples();
726 throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
730 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
732 const float *vals(self->begin());
733 return convertDblArrToPyList<float>(vals,self->getNbOfElems());
736 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
738 const float *vals(self->begin());
739 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
740 return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
743 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
745 return DataArrayT__getitem<float>(self,obj);
748 DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
750 return DataArrayT__setitem__<float>(self,obj,value);
753 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
755 return DataArrayT_iadd<float>(trueSelf,obj,self);
758 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
760 return DataArrayT_isub<float>(trueSelf,obj,self);
763 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
765 return DataArrayT_imul<float>(trueSelf,obj,self);
768 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
770 return DataArrayT_idiv<float>(trueSelf,obj,self);
774 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
776 return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
781 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
783 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayFloat");
786 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
789 if(!self->isAllocated())
790 throw INTERP_KERNEL::Exception("PyWrap of DataArrayFloat.__getnewargs__ : self is not allocated !");
791 PyObject *ret(PyTuple_New(1));
792 PyObject *ret0(PyDict_New());
793 PyObject *numpyArryObj(MEDCoupling_DataArrayFloat_toNumPyArray(self));
794 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
795 PyObject *tmp1(PyInt_FromLong(0));
796 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
797 PyTuple_SetItem(ret,0,ret0);
801 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
807 class DataArrayFloatTuple;
809 class DataArrayFloatIterator
812 DataArrayFloatIterator(DataArrayFloat *da);
813 ~DataArrayFloatIterator();
818 DataArrayFloatTuple *ret=self->nextt();
820 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple,SWIG_POINTER_OWN|0);
823 PyErr_SetString(PyExc_StopIteration,"No more data.");
830 class DataArrayFloatTuple
833 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
834 DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
837 std::string __str__() const throw(INTERP_KERNEL::Exception)
842 float __float__() const throw(INTERP_KERNEL::Exception)
844 return self->floatValue();
847 DataArrayFloat *buildDAFloat() throw(INTERP_KERNEL::Exception)
849 return self->buildDAFloat(1,self->getNumberOfCompo());
852 /*PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
854 MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
855 MEDCoupling_DataArrayFloat____imul___(ret,0,obj);
856 Py_XINCREF(trueSelf);
860 PyObject *__len__() throw(INTERP_KERNEL::Exception)
862 return PyInt_FromLong(self->getNumberOfCompo());
868 class DataArrayDoubleIterator;
870 class DataArrayDouble : public DataArray
873 static DataArrayDouble *New();
874 double doubleValue() const throw(INTERP_KERNEL::Exception);
875 bool empty() const throw(INTERP_KERNEL::Exception);
876 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
877 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
878 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
879 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
880 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
881 double popBackSilent() throw(INTERP_KERNEL::Exception);
882 void pack() const throw(INTERP_KERNEL::Exception);
883 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
884 void fillWithZero() throw(INTERP_KERNEL::Exception);
885 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
886 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
887 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
888 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
889 void reverse() throw(INTERP_KERNEL::Exception);
890 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
891 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
892 std::string repr() const throw(INTERP_KERNEL::Exception);
893 std::string reprZip() const throw(INTERP_KERNEL::Exception);
894 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
895 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
896 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
897 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
898 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
899 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
900 void transpose() throw(INTERP_KERNEL::Exception);
901 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
902 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
903 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
904 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
905 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
906 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
907 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
908 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
909 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
910 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
911 double front() const throw(INTERP_KERNEL::Exception);
912 double back() const throw(INTERP_KERNEL::Exception);
913 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
914 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
915 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
916 double *getPointer() throw(INTERP_KERNEL::Exception);
917 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
918 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
919 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
920 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
921 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
922 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
923 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
924 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
925 double getAverageValue() const throw(INTERP_KERNEL::Exception);
926 double norm2() const throw(INTERP_KERNEL::Exception);
927 double normMax() const throw(INTERP_KERNEL::Exception);
928 double normMin() const throw(INTERP_KERNEL::Exception);
929 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
930 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
931 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
932 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
933 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
934 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
935 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
936 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
937 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
938 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
939 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
940 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
941 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
942 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
943 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
944 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
945 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
946 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
947 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
948 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
949 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
950 void abs() throw(INTERP_KERNEL::Exception);
951 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
952 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
953 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
954 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
955 void applyPow(double val) throw(INTERP_KERNEL::Exception);
956 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
957 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
958 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
959 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
960 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
961 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
962 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
963 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
964 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
965 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
966 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
967 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
968 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
969 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
970 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
971 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
972 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
973 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
974 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
975 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
976 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
977 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
978 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
979 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
980 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
981 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
982 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
983 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
984 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
985 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
986 MCAuto<DataArrayInt> findIdsGreaterThan(double val) const throw(INTERP_KERNEL::Exception);
987 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
988 MCAuto<DataArrayInt> findIdsLowerThan(double val) const throw(INTERP_KERNEL::Exception);
989 MCAuto<DataArrayInt> convertToIntArr() const throw(INTERP_KERNEL::Exception);
990 MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
991 MCAuto<DataArrayDouble> cumSum() const throw(INTERP_KERNEL::Exception);
992 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
995 DataArrayDouble() throw(INTERP_KERNEL::Exception)
997 return DataArrayDouble::New();
1000 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1002 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
1005 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1007 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
1010 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
1013 std::vector<double> bb;
1015 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
1016 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
1017 self->pushBackValsSilent(tmp,tmp+nbTuples);
1020 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1022 std::ostringstream oss;
1023 self->reprQuickOverview(oss);
1027 std::string __str__() const throw(INTERP_KERNEL::Exception)
1029 return self->reprNotTooLong();
1032 double __float__() const throw(INTERP_KERNEL::Exception)
1034 return self->doubleValue();
1037 int __len__() const throw(INTERP_KERNEL::Exception)
1039 if(self->isAllocated())
1041 return self->getNumberOfTuples();
1045 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
1049 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
1051 return self->iterator();
1054 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1056 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 !";
1057 if(PyList_Check(li) || PyTuple_Check(li))
1061 if(PyInt_Check(nbOfTuples))
1063 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1065 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
1068 if(PyInt_Check(nbOfComp))
1069 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
1070 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1072 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
1073 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
1074 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1077 throw INTERP_KERNEL::Exception(msg);
1080 {//DataArrayDouble.setValues([1.,3.,4.],3)
1082 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
1083 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1087 throw INTERP_KERNEL::Exception(msg);
1090 {// DataArrayDouble.setValues([1.,3.,4.])
1091 int tmpp1=-1,tmpp2=-1;
1092 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
1093 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1097 throw INTERP_KERNEL::Exception(msg);
1100 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
1102 const double *vals(self->begin());
1103 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
1107 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
1109 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1113 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1116 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1117 PyObject *ret=PyTuple_New(2);
1118 PyObject *ret0Py=ret0?Py_True:Py_False;
1120 PyTuple_SetItem(ret,0,ret0Py);
1121 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1125 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1127 const double *vals(self->begin());
1128 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1129 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1132 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1134 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1136 DataArrayDouble *a,*a2;
1137 DataArrayDoubleTuple *aa,*aa2;
1138 std::vector<double> bb,bb2;
1140 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1141 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1142 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1146 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1148 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1150 DataArrayDouble *a,*a2;
1151 DataArrayDoubleTuple *aa,*aa2;
1152 std::vector<double> bb,bb2;
1154 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1156 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1157 return convertDblArrToPyListOfTuple<double>(res,3,3);
1160 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1162 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1164 DataArrayDouble *a,*a2;
1165 DataArrayDoubleTuple *aa,*aa2;
1166 std::vector<double> bb,bb2;
1168 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1169 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1170 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1173 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1176 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1177 if (!SWIG_IsOK(res1))
1180 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1181 if(size!=self->getNumberOfTuples())
1183 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1185 return self->renumber(tmp);
1189 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1191 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1192 da2->checkAllocated();
1193 int size=self->getNumberOfTuples();
1194 if(size!=self->getNumberOfTuples())
1196 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1198 return self->renumber(da2->getConstPointer());
1202 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1205 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1206 if (!SWIG_IsOK(res1))
1209 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1210 if(size!=self->getNumberOfTuples())
1212 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1214 return self->renumberR(tmp);
1218 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1220 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1221 da2->checkAllocated();
1222 int size=self->getNumberOfTuples();
1223 if(size!=self->getNumberOfTuples())
1225 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1227 return self->renumberR(da2->getConstPointer());
1231 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1234 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1235 if (!SWIG_IsOK(res1))
1238 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1239 if(size!=self->getNumberOfTuples())
1241 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1243 return self->renumberAndReduce(tmp,newNbOfTuple);
1247 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1249 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1250 da2->checkAllocated();
1251 int size=self->getNumberOfTuples();
1252 if(size!=self->getNumberOfTuples())
1254 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1256 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1260 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1262 int thisTupleId,otherTupleId;
1263 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1264 PyObject *ret=PyTuple_New(3);
1265 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1266 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1267 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1271 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1274 double r1=self->getMaxValue(tmp);
1275 PyObject *ret=PyTuple_New(2);
1276 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1277 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1281 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1284 double r1=self->getMaxValue2(tmp);
1285 PyObject *ret=PyTuple_New(2);
1286 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1287 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1291 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1294 double r1=self->getMinValue(tmp);
1295 PyObject *ret=PyTuple_New(2);
1296 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1297 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1301 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1304 double r1=self->getMinValue2(tmp);
1305 PyObject *ret=PyTuple_New(2);
1306 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1307 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1311 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1313 int nbOfCompo(self->getNumberOfComponents());
1314 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1315 self->getMinMaxPerComponent(tmp);
1316 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1320 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1322 int sz=self->getNumberOfComponents();
1323 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1324 self->accumulate(tmp);
1325 return convertDblArrToPyList<double>(tmp,sz);
1328 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1331 std::vector<int> val2;
1332 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1333 return self->accumulatePerChunck(bg,bg+sz);
1336 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1338 DataArrayInt *comm, *commIndex;
1339 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1340 PyObject *res = PyList_New(2);
1341 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1342 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1346 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1350 DataArrayDoubleTuple *aa;
1351 std::vector<double> bb;
1353 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1354 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1356 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1357 PyObject *ret=PyTuple_New(2);
1358 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1359 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1363 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1365 std::vector<int> tmp;
1366 convertPyToNewIntArr3(li,tmp);
1367 self->setSelectedComponents(a,tmp);
1370 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1372 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1373 std::size_t sz(retCpp.size());
1374 PyObject *res(PyList_New(sz));
1375 for(std::size_t i=0;i<sz;i++)
1376 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1380 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1382 int sz=self->getNumberOfComponents();
1383 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1384 self->getTuple(tupleId,tmp);
1385 return convertDblArrToPyList<double>(tmp,sz);
1388 static DataArrayDouble *Aggregate(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::Aggregate(tmp);
1395 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1397 std::vector<const DataArrayDouble *> tmp;
1398 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1399 return DataArrayDouble::Meld(tmp);
1402 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1406 DataArrayDoubleTuple *aa;
1407 std::vector<double> bb;
1409 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1410 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1411 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1412 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1413 DataArrayInt *c=0,*cI=0;
1414 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1415 PyObject *ret=PyTuple_New(2);
1416 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1417 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1421 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1423 DataArrayInt *ret1=0;
1424 bool ret0=self->areIncludedInMe(other,prec,ret1);
1425 PyObject *ret=PyTuple_New(2);
1426 PyObject *ret0Py=ret0?Py_True:Py_False;
1428 PyTuple_SetItem(ret,0,ret0Py);
1429 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1433 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1435 return DataArrayT__getitem<double>(self,obj);
1438 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1440 return DataArrayT__setitem__<double>(self,obj,value);
1443 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1445 return self->negate();
1448 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1450 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1453 DataArrayDoubleTuple *aa;
1454 std::vector<double> bb;
1457 #ifndef WITHOUT_AUTOFIELD
1459 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1461 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1464 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1465 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1467 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1470 throw INTERP_KERNEL::Exception(msg);
1474 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1479 MCAuto<DataArrayDouble> ret=self->deepCopy();
1480 ret->applyLin(1.,val);
1481 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1485 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1489 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1490 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1494 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1495 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1498 throw INTERP_KERNEL::Exception(msg);
1502 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1504 const char msg[]="Unexpected situation in __radd__ !";
1507 DataArrayDoubleTuple *aa;
1508 std::vector<double> bb;
1510 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1515 MCAuto<DataArrayDouble> ret=self->deepCopy();
1516 ret->applyLin(1.,val);
1521 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1522 return DataArrayDouble::Add(self,aaa);
1526 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1527 return DataArrayDouble::Add(self,aaa);
1530 throw INTERP_KERNEL::Exception(msg);
1534 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1536 return DataArrayT_iadd<double>(trueSelf,obj,self);
1539 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1541 const char msg[]="Unexpected situation in __sub__ !";
1544 DataArrayDoubleTuple *aa;
1545 std::vector<double> bb;
1548 #ifndef WITHOUT_AUTOFIELD
1550 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1552 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1555 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1556 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1558 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1561 throw INTERP_KERNEL::Exception(msg);
1565 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1570 MCAuto<DataArrayDouble> ret=self->deepCopy();
1571 ret->applyLin(1.,-val);
1572 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1576 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1580 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1581 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1585 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1586 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1589 throw INTERP_KERNEL::Exception(msg);
1593 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1595 const char msg[]="Unexpected situation in __rsub__ !";
1598 DataArrayDoubleTuple *aa;
1599 std::vector<double> bb;
1601 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1606 MCAuto<DataArrayDouble> ret=self->deepCopy();
1607 ret->applyLin(-1.,val);
1612 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1613 return DataArrayDouble::Substract(aaa,self);
1617 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1618 return DataArrayDouble::Substract(aaa,self);
1621 throw INTERP_KERNEL::Exception(msg);
1625 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1627 return DataArrayT_isub<double>(trueSelf,obj,self);
1630 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1632 const char msg[]="Unexpected situation in __mul__ !";
1635 DataArrayDoubleTuple *aa;
1636 std::vector<double> bb;
1639 #ifndef WITHOUT_AUTOFIELD
1641 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1643 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1646 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1647 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1649 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1652 throw INTERP_KERNEL::Exception(msg);
1656 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1661 MCAuto<DataArrayDouble> ret=self->deepCopy();
1662 ret->applyLin(val,0.);
1663 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1667 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1671 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1672 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1676 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1677 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1680 throw INTERP_KERNEL::Exception(msg);
1684 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1686 const char msg[]="Unexpected situation in __rmul__ !";
1689 DataArrayDoubleTuple *aa;
1690 std::vector<double> bb;
1692 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1697 MCAuto<DataArrayDouble> ret=self->deepCopy();
1698 ret->applyLin(val,0.);
1703 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1704 return DataArrayDouble::Multiply(self,aaa);
1708 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1709 return DataArrayDouble::Multiply(self,aaa);
1712 throw INTERP_KERNEL::Exception(msg);
1716 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1718 return DataArrayT_imul<double>(trueSelf,obj,self);
1721 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1723 const char msg[]="Unexpected situation in __div__ !";
1726 DataArrayDoubleTuple *aa;
1727 std::vector<double> bb;
1730 #ifndef WITHOUT_AUTOFIELD
1732 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1734 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1737 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1738 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1740 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1743 throw INTERP_KERNEL::Exception(msg);
1747 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1753 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1754 MCAuto<DataArrayDouble> ret=self->deepCopy();
1755 ret->applyLin(1/val,0.);
1756 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1760 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1764 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1765 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1769 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1770 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1773 throw INTERP_KERNEL::Exception(msg);
1777 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1779 const char msg[]="Unexpected situation in __rdiv__ !";
1782 DataArrayDoubleTuple *aa;
1783 std::vector<double> bb;
1785 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1790 MCAuto<DataArrayDouble> ret=self->deepCopy();
1796 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1797 return DataArrayDouble::Divide(aaa,self);
1801 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1802 return DataArrayDouble::Divide(aaa,self);
1805 throw INTERP_KERNEL::Exception(msg);
1809 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1811 return DataArrayT_idiv<double>(trueSelf,obj,self);
1814 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1816 const char msg[]="Unexpected situation in __pow__ !";
1819 DataArrayDoubleTuple *aa;
1820 std::vector<double> bb;
1822 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1827 MCAuto<DataArrayDouble> ret=self->deepCopy();
1833 return DataArrayDouble::Pow(self,a);
1837 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1838 return DataArrayDouble::Pow(self,aaa);
1842 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1843 return DataArrayDouble::Pow(self,aaa);
1846 throw INTERP_KERNEL::Exception(msg);
1850 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1852 const char msg[]="Unexpected situation in __rpow__ !";
1855 DataArrayDoubleTuple *aa;
1856 std::vector<double> bb;
1858 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1863 MCAuto<DataArrayDouble> ret=self->deepCopy();
1864 ret->applyRPow(val);
1869 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1870 return DataArrayDouble::Pow(aaa,self);
1874 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1875 return DataArrayDouble::Pow(aaa,self);
1878 throw INTERP_KERNEL::Exception(msg);
1882 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1884 const char msg[]="Unexpected situation in __ipow__ !";
1887 DataArrayDoubleTuple *aa;
1888 std::vector<double> bb;
1890 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1895 self->applyPow(val);
1896 Py_XINCREF(trueSelf);
1902 Py_XINCREF(trueSelf);
1907 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1908 self->powEqual(aaa);
1909 Py_XINCREF(trueSelf);
1914 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1915 self->powEqual(aaa);
1916 Py_XINCREF(trueSelf);
1920 throw INTERP_KERNEL::Exception(msg);
1924 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1926 DataArrayInt *c=0,*cI=0;
1928 self->computeTupleIdsNearTuples(other,eps,c,cI);
1929 PyObject *ret=PyTuple_New(2);
1930 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1931 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1935 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1937 DataArrayInt *ret1=0;
1938 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1939 PyObject *ret=PyTuple_New(2);
1940 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1941 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1946 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
1948 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
1951 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
1954 if(!self->isAllocated())
1955 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
1956 PyObject *ret(PyTuple_New(1));
1957 PyObject *ret0(PyDict_New());
1958 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
1959 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
1960 PyObject *tmp1(PyInt_FromLong(0));
1961 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
1962 PyTuple_SetItem(ret,0,ret0);
1966 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
1972 class DataArrayDoubleTuple;
1974 class DataArrayDoubleIterator
1977 DataArrayDoubleIterator(DataArrayDouble *da);
1978 ~DataArrayDoubleIterator();
1983 DataArrayDoubleTuple *ret=self->nextt();
1985 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1988 PyErr_SetString(PyExc_StopIteration,"No more data.");
1995 class DataArrayDoubleTuple
1998 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
1999 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2002 std::string __str__() const throw(INTERP_KERNEL::Exception)
2004 return self->repr();
2007 double __float__() const throw(INTERP_KERNEL::Exception)
2009 return self->doubleValue();
2012 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2014 return self->buildDADouble(1,self->getNumberOfCompo());
2017 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2019 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2020 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2021 Py_XINCREF(trueSelf);
2025 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2027 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2028 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2029 Py_XINCREF(trueSelf);
2033 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2035 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2036 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2037 Py_XINCREF(trueSelf);
2041 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2043 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2044 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2045 Py_XINCREF(trueSelf);
2049 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2051 return PyInt_FromLong(self->getNumberOfCompo());
2054 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2056 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2059 std::vector<int> multiVal;
2060 std::pair<int, std::pair<int,int> > slic;
2061 MEDCoupling::DataArrayInt *daIntTyypp=0;
2062 const double *pt=self->getConstPointer();
2063 int nbc=self->getNumberOfCompo();
2064 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2071 std::ostringstream oss;
2072 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2073 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2077 return PyFloat_FromDouble(pt[singleVal]);
2081 return PyFloat_FromDouble(pt[nbc+singleVal]);
2084 std::ostringstream oss;
2085 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2086 throw INTERP_KERNEL::Exception(oss.str().c_str());
2092 PyObject *t=PyTuple_New(multiVal.size());
2093 for(int j=0;j<(int)multiVal.size();j++)
2095 int cid=multiVal[j];
2098 std::ostringstream oss;
2099 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2100 throw INTERP_KERNEL::Exception(oss.str().c_str());
2102 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2108 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2109 PyObject *t=PyTuple_New(sz);
2110 for(int j=0;j<sz;j++)
2111 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2115 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2119 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2121 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2122 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2125 std::vector<double> multiValV;
2126 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2127 int nbc=self->getNumberOfCompo();
2128 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2130 std::vector<int> multiVal;
2131 std::pair<int, std::pair<int,int> > slic;
2132 MEDCoupling::DataArrayInt *daIntTyypp=0;
2133 double *pt=self->getPointer();
2134 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2141 std::ostringstream oss;
2142 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2143 throw INTERP_KERNEL::Exception(oss.str().c_str());
2149 pt[singleVal]=singleValV;
2154 if(multiValV.size()!=1)
2156 std::ostringstream oss;
2157 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2158 throw INTERP_KERNEL::Exception(oss.str().c_str());
2160 pt[singleVal]=multiValV[0];
2165 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2169 throw INTERP_KERNEL::Exception(msg);
2178 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2182 std::ostringstream oss;
2183 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2184 throw INTERP_KERNEL::Exception(oss.str().c_str());
2192 if(multiVal.size()!=multiValV.size())
2194 std::ostringstream oss;
2195 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2196 throw INTERP_KERNEL::Exception(oss.str().c_str());
2198 for(int i=0;i<(int)multiVal.size();i++)
2200 int pos=multiVal[i];
2203 std::ostringstream oss;
2204 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2205 throw INTERP_KERNEL::Exception(oss.str().c_str());
2207 pt[multiVal[i]]=multiValV[i];
2213 const double *ptV=daIntTyyppV->getConstPointer();
2214 if(nbc>daIntTyyppV->getNumberOfCompo())
2216 std::ostringstream oss;
2217 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2218 throw INTERP_KERNEL::Exception(oss.str().c_str());
2220 std::copy(ptV,ptV+nbc,pt);
2224 throw INTERP_KERNEL::Exception(msg);
2229 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2234 for(int j=0;j<sz;j++)
2235 pt[slic.first+j*slic.second.second]=singleValV;
2240 if(sz!=(int)multiValV.size())
2242 std::ostringstream oss;
2243 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2244 throw INTERP_KERNEL::Exception(oss.str().c_str());
2246 for(int j=0;j<sz;j++)
2247 pt[slic.first+j*slic.second.second]=multiValV[j];
2252 const double *ptV=daIntTyyppV->getConstPointer();
2253 if(sz>daIntTyyppV->getNumberOfCompo())
2255 std::ostringstream oss;
2256 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2257 throw INTERP_KERNEL::Exception(oss.str().c_str());
2259 for(int j=0;j<sz;j++)
2260 pt[slic.first+j*slic.second.second]=ptV[j];
2264 throw INTERP_KERNEL::Exception(msg);
2268 throw INTERP_KERNEL::Exception(msg);
2274 class DataArrayIntIterator;
2276 class DataArrayInt : public DataArray
2279 static DataArrayInt *New();
2280 int intValue() const throw(INTERP_KERNEL::Exception);
2281 int getHashCode() const throw(INTERP_KERNEL::Exception);
2282 bool empty() const throw(INTERP_KERNEL::Exception);
2283 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2284 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2285 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2286 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2287 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2288 int popBackSilent() throw(INTERP_KERNEL::Exception);
2289 void pack() const throw(INTERP_KERNEL::Exception);
2290 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2291 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2292 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2293 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2294 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2295 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2296 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2297 void reverse() throw(INTERP_KERNEL::Exception);
2298 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2299 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2300 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2301 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2302 void fillWithZero() throw(INTERP_KERNEL::Exception);
2303 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2304 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2305 std::string repr() const throw(INTERP_KERNEL::Exception);
2306 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2307 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2308 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2309 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2310 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2311 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2312 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2313 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2314 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2315 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2316 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2317 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2318 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2319 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2320 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2321 void transpose() throw(INTERP_KERNEL::Exception);
2322 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2323 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2324 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2325 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2326 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2327 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2328 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2329 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2330 int front() const throw(INTERP_KERNEL::Exception);
2331 int back() const throw(INTERP_KERNEL::Exception);
2332 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2333 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2334 int *getPointer() throw(INTERP_KERNEL::Exception);
2335 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2336 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2337 const int *begin() const throw(INTERP_KERNEL::Exception);
2338 const int *end() const throw(INTERP_KERNEL::Exception);
2339 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2340 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2341 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2342 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2343 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2344 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2345 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2346 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2347 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2348 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2349 int count(int value) const throw(INTERP_KERNEL::Exception);
2350 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2351 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2352 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2353 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2354 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2355 void abs() throw(INTERP_KERNEL::Exception);
2356 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2357 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2358 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2359 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2360 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2361 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2362 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2363 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2364 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2365 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2366 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2367 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2368 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2369 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2370 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2371 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2372 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2373 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2374 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2375 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2376 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2377 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2378 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2379 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2380 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2381 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2382 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2383 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2384 void computeOffsets() throw(INTERP_KERNEL::Exception);
2385 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2386 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2387 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2388 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2389 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2390 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2391 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2392 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2393 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2394 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2395 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2396 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2397 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2398 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2399 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2400 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2401 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2402 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2403 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2404 MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
2405 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2406 MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
2407 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2408 MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
2409 MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
2410 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
2411 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
2413 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2416 DataArrayInt() throw(INTERP_KERNEL::Exception)
2418 return DataArrayInt::New();
2421 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2423 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)";
2424 std::string msg(msgBase);
2426 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2429 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2433 if(PyInt_Check(nbOfTuples))
2435 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2437 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2440 if(PyInt_Check(nbOfComp))
2441 {//DataArrayInt.New([1,3,4,5],2,2)
2442 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2444 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2445 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2446 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2447 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2451 throw INTERP_KERNEL::Exception(msg.c_str());
2454 {//DataArrayInt.New([1,3,4],3)
2455 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2457 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2458 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2463 throw INTERP_KERNEL::Exception(msg.c_str());
2466 {// DataArrayInt.New([1,3,4])
2467 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2468 int tmpp1=-1,tmpp2=-1;
2469 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2470 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2474 else if(PyInt_Check(elt0))
2476 int nbOfTuples1=PyInt_AS_LONG(elt0);
2478 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2483 if(PyInt_Check(nbOfTuples))
2484 {//DataArrayInt.New(5,2)
2485 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2487 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2488 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2489 ret->alloc(nbOfTuples1,nbOfCompo);
2493 throw INTERP_KERNEL::Exception(msg.c_str());
2496 throw INTERP_KERNEL::Exception(msg.c_str());
2499 {//DataArrayInt.New(5)
2500 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2501 ret->alloc(nbOfTuples1,1);
2506 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2507 {//DataArrayInt.New(numpyArray)
2508 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2512 throw INTERP_KERNEL::Exception(msg.c_str());
2513 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2516 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2518 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2521 std::string __str__() const throw(INTERP_KERNEL::Exception)
2523 return self->reprNotTooLong();
2526 int __len__() const throw(INTERP_KERNEL::Exception)
2528 if(self->isAllocated())
2530 return self->getNumberOfTuples();
2534 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2538 int __int__() const throw(INTERP_KERNEL::Exception)
2540 return self->intValue();
2543 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2545 return self->iterator();
2548 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2550 int sz=self->getNumberOfComponents();
2551 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2552 self->accumulate(tmp);
2553 return convertIntArrToPyList(tmp,sz);
2556 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2559 std::vector<int> val2;
2560 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2561 return self->accumulatePerChunck(bg,bg+sz);
2564 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2567 std::vector<int> val2;
2568 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2569 return self->findIdsEqualTuple(bg,bg+sz);
2572 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2574 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2575 PyObject *ret=PyList_New(slcs.size());
2576 for(std::size_t i=0;i<slcs.size();i++)
2577 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2581 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2583 if(!PySlice_Check(slic))
2584 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2585 Py_ssize_t strt=2,stp=2,step=2;
2586 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2587 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2588 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2589 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 !");
2590 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2593 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2596 self->getMinMaxValues(a,b);
2597 PyObject *ret=PyTuple_New(2);
2598 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2599 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2603 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2605 int newNbOfTuples=-1;
2606 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2607 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2608 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2609 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2610 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2611 PyObject *ret=PyTuple_New(2);
2612 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2613 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2617 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2619 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2620 int szArr,sw,iTypppArr;
2621 std::vector<int> stdvecTyyppArr;
2622 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2623 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2624 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2628 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2630 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 !";
2631 if(PyList_Check(li) || PyTuple_Check(li))
2633 if(nbOfTuples && nbOfTuples != Py_None)
2635 if(PyInt_Check(nbOfTuples))
2637 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2639 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2640 if(nbOfComp && nbOfComp != Py_None)
2642 if(PyInt_Check(nbOfComp))
2643 {//DataArrayInt.setValues([1,3,4,5],2,2)
2644 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2646 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2647 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2648 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2651 throw INTERP_KERNEL::Exception(msg);
2654 {//DataArrayInt.setValues([1,3,4],3)
2656 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2657 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2661 throw INTERP_KERNEL::Exception(msg);
2664 {// DataArrayInt.setValues([1,3,4])
2665 int tmpp1=-1,tmpp2=-1;
2666 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2667 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2671 throw INTERP_KERNEL::Exception(msg);
2674 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2676 const int *vals=self->getConstPointer();
2677 return convertIntArrToPyList(vals,self->getNbOfElems());
2681 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2683 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2687 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2690 bool ret0=self->isEqualIfNotWhy(other,ret1);
2691 PyObject *ret=PyTuple_New(2);
2692 PyObject *ret0Py=ret0?Py_True:Py_False;
2694 PyTuple_SetItem(ret,0,ret0Py);
2695 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2699 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2701 const int *vals=self->getConstPointer();
2702 int nbOfComp=self->getNumberOfComponents();
2703 int nbOfTuples=self->getNumberOfTuples();
2704 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2707 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2709 std::vector<const DataArrayInt *> groups;
2710 std::vector< std::vector<int> > fidsOfGroups;
2711 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2712 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2713 PyObject *ret = PyList_New(2);
2714 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2715 int sz=fidsOfGroups.size();
2716 PyObject *ret1 = PyList_New(sz);
2717 for(int i=0;i<sz;i++)
2718 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2719 PyList_SetItem(ret,1,ret1);
2723 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2726 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2727 if (!SWIG_IsOK(res1))
2730 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2731 self->transformWithIndArr(tmp,tmp+size);
2735 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2736 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2740 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2744 std::vector<int> multiVal;
2745 std::pair<int, std::pair<int,int> > slic;
2746 MEDCoupling::DataArrayInt *daIntTyypp=0;
2747 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2751 return self->findIdsEqualList(&singleVal,&singleVal+1);
2753 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2755 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2757 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2761 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2765 std::vector<int> multiVal;
2766 std::pair<int, std::pair<int,int> > slic;
2767 MEDCoupling::DataArrayInt *daIntTyypp=0;
2768 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2772 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2774 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2776 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2778 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2782 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2784 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2786 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2787 if (!SWIG_IsOK(res1))
2790 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2791 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2795 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2797 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2798 da2->checkAllocated();
2799 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2801 PyObject *ret = PyList_New(3);
2802 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2803 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2804 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2808 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2811 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2812 if (!SWIG_IsOK(res1))
2815 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2816 return self->transformWithIndArrR(tmp,tmp+size);
2820 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2821 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2825 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2828 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2829 if (!SWIG_IsOK(res1))
2832 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2833 if(size!=self->getNumberOfTuples())
2835 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2837 return self->renumberAndReduce(tmp,newNbOfTuple);
2841 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2843 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2844 da2->checkAllocated();
2845 int size=self->getNumberOfTuples();
2846 if(size!=self->getNumberOfTuples())
2848 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2850 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2854 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2857 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2858 if (!SWIG_IsOK(res1))
2861 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2862 if(size!=self->getNumberOfTuples())
2864 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2866 return self->renumber(tmp);
2870 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2872 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2873 da2->checkAllocated();
2874 int size=self->getNumberOfTuples();
2875 if(size!=self->getNumberOfTuples())
2877 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2879 return self->renumber(da2->getConstPointer());
2883 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2886 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2887 if (!SWIG_IsOK(res1))
2890 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2891 if(size!=self->getNumberOfTuples())
2893 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2895 return self->renumberR(tmp);
2899 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2901 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2902 da2->checkAllocated();
2903 int size=self->getNumberOfTuples();
2904 if(size!=self->getNumberOfTuples())
2906 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2908 return self->renumberR(da2->getConstPointer());
2912 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2914 std::vector<int> tmp;
2915 convertPyToNewIntArr3(li,tmp);
2916 self->setSelectedComponents(a,tmp);
2919 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2921 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2922 std::size_t sz(retCpp.size());
2923 PyObject *res(PyList_New(sz));
2924 for(std::size_t i=0;i<sz;i++)
2925 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2929 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2931 int sz=self->getNumberOfComponents();
2932 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2933 self->getTuple(tupleId,tmp);
2934 return convertIntArrToPyList(tmp,sz);
2937 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2939 DataArrayInt *arr=0;
2940 DataArrayInt *arrI=0;
2941 self->changeSurjectiveFormat(targetNb,arr,arrI);
2942 PyObject *res = PyList_New(2);
2943 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2944 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2948 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2950 std::vector<const DataArrayInt *> tmp;
2951 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2952 return DataArrayInt::Meld(tmp);
2955 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2957 std::vector<const DataArrayInt *> tmp;
2958 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2959 return DataArrayInt::Aggregate(tmp);
2962 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2964 std::vector<const DataArrayInt *> tmp;
2965 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2966 return DataArrayInt::AggregateIndexes(tmp);
2969 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2971 std::vector<const DataArrayInt *> tmp;
2972 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2973 return DataArrayInt::BuildUnion(tmp);
2976 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2978 std::vector<const DataArrayInt *> tmp;
2979 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2980 return DataArrayInt::BuildIntersection(tmp);
2983 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2986 int r1=self->getMaxValue(tmp);
2987 PyObject *ret=PyTuple_New(2);
2988 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2989 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2993 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2996 int r1=self->getMinValue(tmp);
2997 PyObject *ret=PyTuple_New(2);
2998 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2999 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3003 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3005 int nbOfCompo=self->getNumberOfComponents();
3010 if(PyInt_Check(obj))
3012 int val=(int)PyInt_AS_LONG(obj);
3013 return self->findIdFirstEqual(val);
3016 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3020 std::vector<int> arr;
3021 convertPyToNewIntArr3(obj,arr);
3022 return self->findIdFirstEqualTuple(arr);
3027 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3029 int nbOfCompo=self->getNumberOfComponents();
3036 if(PyInt_Check(obj))
3038 int val=(int)PyInt_AS_LONG(obj);
3039 return self->presenceOfValue(val);
3042 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3046 std::vector<int> arr;
3047 convertPyToNewIntArr3(obj,arr);
3048 return self->presenceOfTuple(arr);
3053 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3055 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3056 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3057 self->checkAllocated();
3058 int nbOfTuples=self->getNumberOfTuples();
3059 int nbOfComponents=self->getNumberOfComponents();
3061 std::vector<int> vt1,vc1;
3062 std::pair<int, std::pair<int,int> > pt1,pc1;
3063 DataArrayInt *dt1=0,*dc1=0;
3065 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3066 MCAuto<DataArrayInt> ret;
3071 if(nbOfComponents==1)
3072 return PyInt_FromLong(self->getIJSafe(it1,0));
3073 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3076 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3078 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3080 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3082 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3085 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3086 std::vector<int> v2(1,ic1);
3087 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3091 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3092 std::vector<int> v2(1,ic1);
3093 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3097 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3098 std::vector<int> v2(1,ic1);
3099 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3103 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3104 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3108 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3109 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3113 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3114 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3118 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3119 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3123 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3124 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3125 std::vector<int> v2(nbOfComp);
3126 for(int i=0;i<nbOfComp;i++)
3127 v2[i]=pc1.first+i*pc1.second.second;
3128 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3132 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3133 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3134 std::vector<int> v2(nbOfComp);
3135 for(int i=0;i<nbOfComp;i++)
3136 v2[i]=pc1.first+i*pc1.second.second;
3137 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3141 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3142 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3143 std::vector<int> v2(nbOfComp);
3144 for(int i=0;i<nbOfComp;i++)
3145 v2[i]=pc1.first+i*pc1.second.second;
3146 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3150 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3151 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3152 std::vector<int> v2(nbOfComp);
3153 for(int i=0;i<nbOfComp;i++)
3154 v2[i]=pc1.first+i*pc1.second.second;
3155 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3158 throw INTERP_KERNEL::Exception(msg);
3162 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3164 self->checkAllocated();
3165 const char msg[]="Unexpected situation in __setitem__ !";
3166 int nbOfTuples=self->getNumberOfTuples();
3167 int nbOfComponents=self->getNumberOfComponents();
3170 std::vector<int> v1;
3172 DataArrayIntTuple *dd1=0;
3173 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3175 std::vector<int> vt1,vc1;
3176 std::pair<int, std::pair<int,int> > pt1,pc1;
3177 DataArrayInt *dt1=0,*dc1=0;
3178 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3179 MCAuto<DataArrayInt> tmp;
3187 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3190 tmp=DataArrayInt::New();
3191 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3192 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3195 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3198 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3199 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3202 throw INTERP_KERNEL::Exception(msg);
3211 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3214 tmp=DataArrayInt::New();
3215 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3216 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3219 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3222 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3223 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3226 throw INTERP_KERNEL::Exception(msg);
3235 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3238 tmp=DataArrayInt::New();
3239 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3240 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3243 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3246 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3247 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3250 throw INTERP_KERNEL::Exception(msg);
3259 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3262 tmp=DataArrayInt::New();
3263 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3264 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3267 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3270 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3271 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3274 throw INTERP_KERNEL::Exception(msg);
3283 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3286 tmp=DataArrayInt::New();
3287 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3288 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3291 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3294 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3295 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3298 throw INTERP_KERNEL::Exception(msg);
3307 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3310 tmp=DataArrayInt::New();
3311 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3312 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3315 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3318 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3319 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3322 throw INTERP_KERNEL::Exception(msg);
3331 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3334 tmp=DataArrayInt::New();
3335 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3336 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3339 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3342 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3343 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3346 throw INTERP_KERNEL::Exception(msg);
3355 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3358 tmp=DataArrayInt::New();
3359 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3360 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3363 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3366 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3367 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3370 throw INTERP_KERNEL::Exception(msg);
3379 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3382 tmp=DataArrayInt::New();
3383 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3384 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3387 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3390 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3391 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3394 throw INTERP_KERNEL::Exception(msg);
3403 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3406 tmp=DataArrayInt::New();
3407 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3408 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3411 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3414 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3415 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3418 throw INTERP_KERNEL::Exception(msg);
3427 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3430 tmp=DataArrayInt::New();
3431 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3432 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3435 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3438 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3439 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3442 throw INTERP_KERNEL::Exception(msg);
3451 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3454 tmp=DataArrayInt::New();
3455 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3456 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3459 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3462 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3463 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3466 throw INTERP_KERNEL::Exception(msg);
3475 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3478 tmp=DataArrayInt::New();
3479 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3480 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3483 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3486 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3487 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3490 throw INTERP_KERNEL::Exception(msg);
3499 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3502 tmp=DataArrayInt::New();
3503 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3504 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3507 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3510 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3511 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3514 throw INTERP_KERNEL::Exception(msg);
3523 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3526 tmp=DataArrayInt::New();
3527 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3528 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3531 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3534 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3535 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3538 throw INTERP_KERNEL::Exception(msg);
3547 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3550 tmp=DataArrayInt::New();
3551 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3552 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3555 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3558 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3559 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3562 throw INTERP_KERNEL::Exception(msg);
3567 throw INTERP_KERNEL::Exception(msg);
3572 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3574 return self->negate();
3577 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3579 const char msg[]="Unexpected situation in __add__ !";
3582 std::vector<int> aa;
3583 DataArrayIntTuple *aaa;
3585 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3590 MCAuto<DataArrayInt> ret=self->deepCopy();
3591 ret->applyLin(1,val);
3596 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3597 return DataArrayInt::Add(self,aaaa);
3601 return DataArrayInt::Add(self,a);
3605 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3606 return DataArrayInt::Add(self,aaaa);
3609 throw INTERP_KERNEL::Exception(msg);
3613 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3615 const char msg[]="Unexpected situation in __radd__ !";
3618 std::vector<int> aa;
3619 DataArrayIntTuple *aaa;
3621 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3626 MCAuto<DataArrayInt> ret=self->deepCopy();
3627 ret->applyLin(1,val);
3632 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3633 return DataArrayInt::Add(self,aaaa);
3637 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3638 return DataArrayInt::Add(self,aaaa);
3641 throw INTERP_KERNEL::Exception(msg);
3645 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3647 const char msg[]="Unexpected situation in __iadd__ !";
3650 std::vector<int> aa;
3651 DataArrayIntTuple *aaa;
3653 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3658 self->applyLin(1,val);
3659 Py_XINCREF(trueSelf);
3664 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3666 Py_XINCREF(trueSelf);
3672 Py_XINCREF(trueSelf);
3677 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3678 self->addEqual(aaaa);
3679 Py_XINCREF(trueSelf);
3683 throw INTERP_KERNEL::Exception(msg);
3687 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3689 const char msg[]="Unexpected situation in __sub__ !";
3692 std::vector<int> aa;
3693 DataArrayIntTuple *aaa;
3695 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3700 MCAuto<DataArrayInt> ret=self->deepCopy();
3701 ret->applyLin(1,-val);
3706 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3707 return DataArrayInt::Substract(self,aaaa);
3711 return DataArrayInt::Substract(self,a);
3715 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3716 return DataArrayInt::Substract(self,aaaa);
3719 throw INTERP_KERNEL::Exception(msg);
3723 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3725 const char msg[]="Unexpected situation in __rsub__ !";
3728 std::vector<int> aa;
3729 DataArrayIntTuple *aaa;
3731 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3736 MCAuto<DataArrayInt> ret=self->deepCopy();
3737 ret->applyLin(-1,val);
3742 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3743 return DataArrayInt::Substract(aaaa,self);
3747 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3748 return DataArrayInt::Substract(aaaa,self);
3751 throw INTERP_KERNEL::Exception(msg);
3755 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3757 const char msg[]="Unexpected situation in __isub__ !";
3760 std::vector<int> aa;
3761 DataArrayIntTuple *aaa;
3763 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3768 self->applyLin(1,-val);
3769 Py_XINCREF(trueSelf);
3774 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3775 self->substractEqual(bb);
3776 Py_XINCREF(trueSelf);
3781 self->substractEqual(a);
3782 Py_XINCREF(trueSelf);
3787 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3788 self->substractEqual(aaaa);
3789 Py_XINCREF(trueSelf);
3793 throw INTERP_KERNEL::Exception(msg);
3797 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3799 const char msg[]="Unexpected situation in __mul__ !";
3802 std::vector<int> aa;
3803 DataArrayIntTuple *aaa;
3805 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3810 MCAuto<DataArrayInt> ret=self->deepCopy();
3811 ret->applyLin(val,0);
3816 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3817 return DataArrayInt::Multiply(self,aaaa);
3821 return DataArrayInt::Multiply(self,a);
3825 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3826 return DataArrayInt::Multiply(self,aaaa);
3829 throw INTERP_KERNEL::Exception(msg);
3833 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3835 const char msg[]="Unexpected situation in __rmul__ !";
3838 std::vector<int> aa;
3839 DataArrayIntTuple *aaa;
3841 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3846 MCAuto<DataArrayInt> ret=self->deepCopy();
3847 ret->applyLin(val,0);
3852 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3853 return DataArrayInt::Multiply(self,aaaa);
3857 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3858 return DataArrayInt::Multiply(self,aaaa);
3861 throw INTERP_KERNEL::Exception(msg);
3865 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3867 const char msg[]="Unexpected situation in __imul__ !";
3870 std::vector<int> aa;
3871 DataArrayIntTuple *aaa;
3873 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3878 self->applyLin(val,0);
3879 Py_XINCREF(trueSelf);
3884 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3885 self->multiplyEqual(bb);
3886 Py_XINCREF(trueSelf);
3891 self->multiplyEqual(a);
3892 Py_XINCREF(trueSelf);
3897 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3898 self->multiplyEqual(aaaa);
3899 Py_XINCREF(trueSelf);
3903 throw INTERP_KERNEL::Exception(msg);
3907 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3909 const char msg[]="Unexpected situation in __div__ !";
3912 std::vector<int> aa;
3913 DataArrayIntTuple *aaa;
3915 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3920 MCAuto<DataArrayInt> ret=self->deepCopy();
3921 ret->applyDivideBy(val);
3926 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3927 return DataArrayInt::Divide(self,aaaa);
3931 return DataArrayInt::Divide(self,a);
3935 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3936 return DataArrayInt::Divide(self,aaaa);
3939 throw INTERP_KERNEL::Exception(msg);
3943 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3945 const char msg[]="Unexpected situation in __rdiv__ !";
3948 std::vector<int> aa;
3949 DataArrayIntTuple *aaa;
3951 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3956 MCAuto<DataArrayInt> ret=self->deepCopy();
3962 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3963 return DataArrayInt::Divide(aaaa,self);
3967 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3968 return DataArrayInt::Divide(aaaa,self);
3971 throw INTERP_KERNEL::Exception(msg);
3975 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3977 const char msg[]="Unexpected situation in __idiv__ !";
3980 std::vector<int> aa;
3981 DataArrayIntTuple *aaa;
3983 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3988 self->applyDivideBy(val);
3989 Py_XINCREF(trueSelf);
3994 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3995 self->divideEqual(bb);
3996 Py_XINCREF(trueSelf);
4001 self->divideEqual(a);
4002 Py_XINCREF(trueSelf);
4007 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4008 self->divideEqual(aaaa);
4009 Py_XINCREF(trueSelf);
4013 throw INTERP_KERNEL::Exception(msg);
4017 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4019 const char msg[]="Unexpected situation in __mod__ !";
4022 std::vector<int> aa;
4023 DataArrayIntTuple *aaa;
4025 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4030 MCAuto<DataArrayInt> ret=self->deepCopy();
4031 ret->applyModulus(val);
4036 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4037 return DataArrayInt::Modulus(self,aaaa);
4041 return DataArrayInt::Modulus(self,a);
4045 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4046 return DataArrayInt::Modulus(self,aaaa);
4049 throw INTERP_KERNEL::Exception(msg);
4053 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4055 const char msg[]="Unexpected situation in __rmod__ !";
4058 std::vector<int> aa;
4059 DataArrayIntTuple *aaa;
4061 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4066 MCAuto<DataArrayInt> ret=self->deepCopy();
4067 ret->applyRModulus(val);
4072 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4073 return DataArrayInt::Modulus(aaaa,self);
4077 return DataArrayInt::Modulus(a,self);
4081 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4082 return DataArrayInt::Modulus(aaaa,self);
4085 throw INTERP_KERNEL::Exception(msg);
4089 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4091 const char msg[]="Unexpected situation in __imod__ !";
4094 std::vector<int> aa;
4095 DataArrayIntTuple *aaa;
4097 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4102 self->applyModulus(val);
4103 Py_XINCREF(trueSelf);
4108 self->modulusEqual(a);
4109 Py_XINCREF(trueSelf);
4114 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4115 self->modulusEqual(aaaa);
4116 Py_XINCREF(trueSelf);
4120 throw INTERP_KERNEL::Exception(msg);
4124 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4126 const char msg[]="Unexpected situation in __pow__ !";
4129 std::vector<int> aa;
4130 DataArrayIntTuple *aaa;
4132 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4137 MCAuto<DataArrayInt> ret=self->deepCopy();
4143 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4144 return DataArrayInt::Pow(self,aaaa);
4148 return DataArrayInt::Pow(self,a);
4152 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4153 return DataArrayInt::Pow(self,aaaa);
4156 throw INTERP_KERNEL::Exception(msg);
4160 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4162 const char msg[]="Unexpected situation in __rpow__ !";
4165 std::vector<int> aa;
4166 DataArrayIntTuple *aaa;
4168 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4173 MCAuto<DataArrayInt> ret=self->deepCopy();
4174 ret->applyRPow(val);
4179 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4180 return DataArrayInt::Pow(aaaa,self);
4184 return DataArrayInt::Pow(a,self);
4188 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4189 return DataArrayInt::Pow(aaaa,self);
4192 throw INTERP_KERNEL::Exception(msg);
4196 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4198 const char msg[]="Unexpected situation in __ipow__ !";
4201 std::vector<int> aa;
4202 DataArrayIntTuple *aaa;
4204 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4209 self->applyPow(val);
4210 Py_XINCREF(trueSelf);
4216 Py_XINCREF(trueSelf);
4221 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4222 self->powEqual(aaaa);
4223 Py_XINCREF(trueSelf);
4227 throw INTERP_KERNEL::Exception(msg);
4231 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4233 std::ostringstream oss;
4234 self->reprQuickOverview(oss);
4238 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4240 int szArr,sw,iTypppArr;
4241 std::vector<int> stdvecTyyppArr;
4242 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4243 self->pushBackValsSilent(tmp,tmp+szArr);
4246 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4248 std::vector<int> ret1;
4249 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4250 std::size_t sz=ret0.size();
4251 PyObject *pyRet=PyTuple_New(2);
4252 PyObject *pyRet0=PyList_New((int)sz);
4253 PyObject *pyRet1=PyList_New((int)sz);
4254 for(std::size_t i=0;i<sz;i++)
4256 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4257 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4259 PyTuple_SetItem(pyRet,0,pyRet0);
4260 PyTuple_SetItem(pyRet,1,pyRet1);
4264 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4266 DataArrayInt *ret0=0,*ret1=0;
4267 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4268 PyObject *pyRet=PyTuple_New(2);
4269 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4270 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4274 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4277 bool ret(self->isRange(a,b,c));
4278 PyObject *pyRet=PyTuple_New(2);
4279 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4281 PyTuple_SetItem(pyRet,0,ret0Py);
4283 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4289 PyTuple_SetItem(pyRet,1,ret1Py);
4294 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4296 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4299 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4302 if(!self->isAllocated())
4303 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4304 PyObject *ret(PyTuple_New(1));
4305 PyObject *ret0(PyDict_New());
4306 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4307 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4308 PyObject *tmp1(PyInt_FromLong(0));
4309 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4310 PyTuple_SetItem(ret,0,ret0);
4314 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4320 class DataArrayIntTuple;
4322 class DataArrayIntIterator
4325 DataArrayIntIterator(DataArrayInt *da);
4326 ~DataArrayIntIterator();
4331 DataArrayIntTuple *ret=self->nextt();
4333 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4336 PyErr_SetString(PyExc_StopIteration,"No more data.");
4343 class DataArrayIntTuple
4346 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4347 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4350 std::string __str__() const throw(INTERP_KERNEL::Exception)
4352 return self->repr();
4355 int __int__() const throw(INTERP_KERNEL::Exception)
4357 return self->intValue();
4360 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4362 return self->buildDAInt(1,self->getNumberOfCompo());
4365 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4367 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4368 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4369 Py_XINCREF(trueSelf);
4373 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4375 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4376 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4377 Py_XINCREF(trueSelf);
4381 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4383 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4384 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4385 Py_XINCREF(trueSelf);
4389 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4391 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4392 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4393 Py_XINCREF(trueSelf);
4397 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4399 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4400 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4401 Py_XINCREF(trueSelf);
4405 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4407 return PyInt_FromLong(self->getNumberOfCompo());
4410 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4412 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4415 std::vector<int> multiVal;
4416 std::pair<int, std::pair<int,int> > slic;
4417 MEDCoupling::DataArrayInt *daIntTyypp=0;
4418 const int *pt=self->getConstPointer();
4419 int nbc=self->getNumberOfCompo();
4420 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4427 std::ostringstream oss;
4428 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4429 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4433 return PyInt_FromLong(pt[singleVal]);
4437 return PyInt_FromLong(pt[nbc+singleVal]);
4440 std::ostringstream oss;
4441 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4442 throw INTERP_KERNEL::Exception(oss.str().c_str());
4448 PyObject *t=PyTuple_New(multiVal.size());
4449 for(int j=0;j<(int)multiVal.size();j++)
4451 int cid=multiVal[j];
4454 std::ostringstream oss;
4455 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4456 throw INTERP_KERNEL::Exception(oss.str().c_str());
4458 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4464 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4465 PyObject *t=PyTuple_New(sz);
4466 for(int j=0;j<sz;j++)
4467 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4471 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4475 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4477 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4478 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4481 std::vector<int> multiValV;
4482 std::pair<int, std::pair<int,int> > slicV;
4483 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4484 int nbc=self->getNumberOfCompo();
4485 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4487 std::vector<int> multiVal;
4488 std::pair<int, std::pair<int,int> > slic;
4489 MEDCoupling::DataArrayInt *daIntTyypp=0;
4490 int *pt=self->getPointer();
4491 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4498 std::ostringstream oss;
4499 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4500 throw INTERP_KERNEL::Exception(oss.str().c_str());
4506 pt[singleVal]=singleValV;
4511 if(multiValV.size()!=1)
4513 std::ostringstream oss;
4514 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4515 throw INTERP_KERNEL::Exception(oss.str().c_str());
4517 pt[singleVal]=multiValV[0];
4522 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4526 throw INTERP_KERNEL::Exception(msg);
4535 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4539 std::ostringstream oss;
4540 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4541 throw INTERP_KERNEL::Exception(oss.str().c_str());
4549 if(multiVal.size()!=multiValV.size())
4551 std::ostringstream oss;
4552 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4553 throw INTERP_KERNEL::Exception(oss.str().c_str());
4555 for(int i=0;i<(int)multiVal.size();i++)
4557 int pos=multiVal[i];
4560 std::ostringstream oss;
4561 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4562 throw INTERP_KERNEL::Exception(oss.str().c_str());
4564 pt[multiVal[i]]=multiValV[i];
4570 const int *ptV=daIntTyyppV->getConstPointer();
4571 if(nbc>daIntTyyppV->getNumberOfCompo())
4573 std::ostringstream oss;
4574 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4575 throw INTERP_KERNEL::Exception(oss.str().c_str());
4577 std::copy(ptV,ptV+nbc,pt);
4581 throw INTERP_KERNEL::Exception(msg);
4586 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4591 for(int j=0;j<sz;j++)
4592 pt[slic.first+j*slic.second.second]=singleValV;
4597 if(sz!=(int)multiValV.size())
4599 std::ostringstream oss;
4600 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4601 throw INTERP_KERNEL::Exception(oss.str().c_str());
4603 for(int j=0;j<sz;j++)
4604 pt[slic.first+j*slic.second.second]=multiValV[j];
4609 const int *ptV=daIntTyyppV->getConstPointer();
4610 if(sz>daIntTyyppV->getNumberOfCompo())
4612 std::ostringstream oss;
4613 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4614 throw INTERP_KERNEL::Exception(oss.str().c_str());
4616 for(int j=0;j<sz;j++)
4617 pt[slic.first+j*slic.second.second]=ptV[j];
4621 throw INTERP_KERNEL::Exception(msg);
4625 throw INTERP_KERNEL::Exception(msg);
4631 class DataArrayChar : public DataArray
4634 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4635 int getHashCode() const throw(INTERP_KERNEL::Exception);
4636 bool empty() const throw(INTERP_KERNEL::Exception);
4637 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4638 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4639 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4640 char popBackSilent() throw(INTERP_KERNEL::Exception);
4641 void pack() const throw(INTERP_KERNEL::Exception);
4642 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4643 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4644 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4645 void reverse() throw(INTERP_KERNEL::Exception);
4646 void fillWithZero() throw(INTERP_KERNEL::Exception);
4647 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4648 std::string repr() const throw(INTERP_KERNEL::Exception);
4649 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4650 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4651 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4652 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4653 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4654 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4655 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4656 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4657 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4658 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4659 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4660 char front() const throw(INTERP_KERNEL::Exception);
4661 char back() const throw(INTERP_KERNEL::Exception);
4662 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4663 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4664 char *getPointer() throw(INTERP_KERNEL::Exception);
4665 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4666 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4667 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4668 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4669 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4670 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4671 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4672 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4673 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4674 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4675 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4678 int __len__() const throw(INTERP_KERNEL::Exception)
4680 if(self->isAllocated())
4682 return self->getNumberOfTuples();
4686 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4690 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4693 bool ret0=self->isEqualIfNotWhy(other,ret1);
4694 PyObject *ret=PyTuple_New(2);
4695 PyObject *ret0Py=ret0?Py_True:Py_False;
4697 PyTuple_SetItem(ret,0,ret0Py);
4698 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4702 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4705 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4706 if (!SWIG_IsOK(res1))
4709 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4710 if(size!=self->getNumberOfTuples())
4712 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4714 return self->renumber(tmp);
4718 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4720 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4721 da2->checkAllocated();
4722 int size=self->getNumberOfTuples();
4723 if(size!=self->getNumberOfTuples())
4725 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4727 return self->renumber(da2->getConstPointer());
4731 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4734 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4735 if (!SWIG_IsOK(res1))
4738 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4739 if(size!=self->getNumberOfTuples())
4741 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4743 return self->renumberR(tmp);
4747 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4749 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4750 da2->checkAllocated();
4751 int size=self->getNumberOfTuples();
4752 if(size!=self->getNumberOfTuples())
4754 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4756 return self->renumberR(da2->getConstPointer());
4760 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4763 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4764 if (!SWIG_IsOK(res1))
4767 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4768 if(size!=self->getNumberOfTuples())
4770 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4772 return self->renumberAndReduce(tmp,newNbOfTuple);
4776 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4778 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4779 da2->checkAllocated();
4780 int size=self->getNumberOfTuples();
4781 if(size!=self->getNumberOfTuples())
4783 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4785 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4789 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4791 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4792 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4793 return DataArrayChar::Aggregate(tmp);
4796 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4798 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4799 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4800 return DataArrayChar::Meld(tmp);
4805 class DataArrayByteIterator;
4807 class DataArrayByte : public DataArrayChar
4810 static DataArrayByte *New();
4811 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4812 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4813 char byteValue() const throw(INTERP_KERNEL::Exception);
4816 DataArrayByte() throw(INTERP_KERNEL::Exception)
4818 return DataArrayByte::New();
4821 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4823 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) !";
4824 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4828 if(PyInt_Check(nbOfTuples))
4830 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4832 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4835 if(PyInt_Check(nbOfComp))
4836 {//DataArrayByte.New([1,3,4,5],2,2)
4837 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4839 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4840 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4841 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4842 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4846 throw INTERP_KERNEL::Exception(msg);
4849 {//DataArrayByte.New([1,3,4],3)
4850 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4852 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4853 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4858 throw INTERP_KERNEL::Exception(msg);
4861 {// DataArrayByte.New([1,3,4])
4862 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4863 int tmpp1=-1,tmpp2=-1;
4864 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4865 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4869 else if(PyInt_Check(elt0))
4871 int nbOfTuples1=PyInt_AS_LONG(elt0);
4873 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4878 if(PyInt_Check(nbOfTuples))
4879 {//DataArrayByte.New(5,2)
4880 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4882 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4883 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4884 ret->alloc(nbOfTuples1,nbOfCompo);
4888 throw INTERP_KERNEL::Exception(msg);
4891 throw INTERP_KERNEL::Exception(msg);
4894 {//DataArrayByte.New(5)
4895 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4896 ret->alloc(nbOfTuples1,1);
4901 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4902 {//DataArrayDouble.New(numpyArray)
4903 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4907 throw INTERP_KERNEL::Exception(msg);
4910 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4912 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4915 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4917 std::ostringstream oss;
4918 self->reprQuickOverview(oss);
4922 int __int__() const throw(INTERP_KERNEL::Exception)
4924 return (int) self->byteValue();
4927 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4929 return self->iterator();
4932 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4934 return (int)self->getIJ(tupleId,compoId);
4937 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4939 return (int)self->getIJSafe(tupleId,compoId);
4942 std::string __str__() const throw(INTERP_KERNEL::Exception)
4944 return self->repr();
4947 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4949 const char *vals=self->getConstPointer();
4950 int nbOfComp=self->getNumberOfComponents();
4951 int nbOfTuples=self->getNumberOfTuples();
4952 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4955 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4958 int ival=-1; std::vector<int> ivval;
4959 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4960 std::vector<char> vals(sz);
4961 std::copy(pt,pt+sz,vals.begin());
4962 return self->presenceOfTuple(vals);
4965 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4968 int ival=-1; std::vector<int> ivval;
4969 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4970 std::vector<char> vals2(sz);
4971 std::copy(pt,pt+sz,vals2.begin());
4972 return self->presenceOfValue(vals2);
4975 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4978 int ival=-1; std::vector<int> ivval;
4979 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4980 std::vector<char> vals2(sz);
4981 std::copy(pt,pt+sz,vals2.begin());
4982 return self->findIdFirstEqual(vals2);
4985 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4988 int ival=-1; std::vector<int> ivval;
4989 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4990 std::vector<char> vals(sz);
4991 std::copy(pt,pt+sz,vals.begin());
4992 return self->findIdFirstEqualTuple(vals);
4995 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4998 int ival=-1; std::vector<int> ivval;
4999 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
5000 std::vector<char> vals(sz);
5001 std::copy(pt,pt+sz,vals.begin());
5002 return self->findIdSequence(vals);
5005 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5007 int sz=self->getNumberOfComponents();
5008 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5009 self->getTuple(tupleId,tmp);
5010 PyObject *ret=PyTuple_New(sz);
5011 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5015 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5018 int r1=(int)self->getMaxValue(tmp);
5019 PyObject *ret=PyTuple_New(2);
5020 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5021 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5025 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5028 int r1=(int)self->getMinValue(tmp);
5029 PyObject *ret=PyTuple_New(2);
5030 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5031 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5035 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5037 int nbOfCompo=self->getNumberOfComponents();
5042 if(PyInt_Check(obj))
5044 int val=(int)PyInt_AS_LONG(obj);
5045 return self->findIdFirstEqual(val);
5048 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5051 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5055 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5057 int nbOfCompo=self->getNumberOfComponents();
5064 if(PyInt_Check(obj))
5066 int val=(int)PyInt_AS_LONG(obj);
5067 return self->presenceOfValue(val);
5070 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5073 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5078 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5080 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5085 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5087 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5090 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5093 if(!self->isAllocated())
5094 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5095 PyObject *ret(PyTuple_New(1));
5096 PyObject *ret0(PyDict_New());
5097 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5098 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5099 PyObject *tmp1(PyInt_FromLong(0));
5100 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5101 PyTuple_SetItem(ret,0,ret0);
5105 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5109 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5111 self->checkAllocated();
5112 const char msg[]="Unexpected situation in __setitem__ !";
5113 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5116 std::vector<int> v1;
5118 DataArrayIntTuple *dd1=0;
5119 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5121 std::vector<int> vt1,vc1;
5122 std::pair<int, std::pair<int,int> > pt1,pc1;
5123 DataArrayInt *dt1=0,*dc1=0;
5124 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5125 MCAuto<DataArrayInt> tmp;
5133 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5136 throw INTERP_KERNEL::Exception(msg);
5145 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5148 throw INTERP_KERNEL::Exception(msg);
5157 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5160 throw INTERP_KERNEL::Exception(msg);
5169 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5172 throw INTERP_KERNEL::Exception(msg);
5181 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5184 throw INTERP_KERNEL::Exception(msg);
5193 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5196 throw INTERP_KERNEL::Exception(msg);
5205 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5208 throw INTERP_KERNEL::Exception(msg);
5217 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5220 throw INTERP_KERNEL::Exception(msg);
5229 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5232 throw INTERP_KERNEL::Exception(msg);
5241 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5244 throw INTERP_KERNEL::Exception(msg);
5253 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5256 throw INTERP_KERNEL::Exception(msg);
5265 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5268 throw INTERP_KERNEL::Exception(msg);
5277 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5280 throw INTERP_KERNEL::Exception(msg);
5289 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5292 throw INTERP_KERNEL::Exception(msg);
5301 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5304 throw INTERP_KERNEL::Exception(msg);
5313 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5316 throw INTERP_KERNEL::Exception(msg);
5321 throw INTERP_KERNEL::Exception(msg);
5328 class DataArrayByteTuple;
5330 class DataArrayByteIterator
5333 DataArrayByteIterator(DataArrayByte *da);
5334 ~DataArrayByteIterator();
5337 class DataArrayByteTuple
5340 std::string repr() const throw(INTERP_KERNEL::Exception);
5341 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5344 std::string __str__() const throw(INTERP_KERNEL::Exception)
5346 return self->repr();
5349 char __int__() const throw(INTERP_KERNEL::Exception)
5351 return self->byteValue();
5354 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5356 return self->buildDAByte(1,self->getNumberOfCompo());
5361 class DataArrayAsciiCharIterator;
5363 class DataArrayAsciiChar : public DataArrayChar
5366 static DataArrayAsciiChar *New();
5367 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5368 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5369 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5372 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5374 return DataArrayAsciiChar::New();
5377 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5379 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) !";
5380 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5384 if(PyInt_Check(nbOfTuples))
5386 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5388 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5391 if(PyInt_Check(nbOfComp))
5392 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5393 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5395 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5396 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5397 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5398 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5402 throw INTERP_KERNEL::Exception(msg);
5405 {//DataArrayAsciiChar.New([1,3,4],3)
5406 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5408 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5409 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5413 else if(PyString_Check(nbOfTuples))
5415 if(PyString_Size(nbOfTuples)!=1)
5416 throw INTERP_KERNEL::Exception(msg);
5417 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5418 std::vector<std::string> tmp;
5419 if(fillStringVector(elt0,tmp))
5420 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5422 throw INTERP_KERNEL::Exception(msg);
5425 throw INTERP_KERNEL::Exception(msg);
5429 std::vector<std::string> tmmp;
5430 if(fillStringVector(elt0,tmmp))
5431 //DataArrayAsciiChar.New(["abc","de","fghi"])
5432 return DataArrayAsciiChar::New(tmmp,' ');
5435 // DataArrayAsciiChar.New([1,3,4])
5436 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5437 int tmpp1=-1,tmpp2=-1;
5438 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5439 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5444 else if(PyInt_Check(elt0))
5446 int nbOfTuples1=PyInt_AS_LONG(elt0);
5448 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5453 if(PyInt_Check(nbOfTuples))
5454 {//DataArrayAsciiChar.New(5,2)
5455 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5457 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5458 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5459 ret->alloc(nbOfTuples1,nbOfCompo);
5463 throw INTERP_KERNEL::Exception(msg);
5466 throw INTERP_KERNEL::Exception(msg);
5469 {//DataArrayAsciiChar.New(5)
5470 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5471 ret->alloc(nbOfTuples1,1);
5476 throw INTERP_KERNEL::Exception(msg);
5479 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5481 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5484 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5486 std::ostringstream oss;
5487 self->reprQuickOverview(oss);
5491 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5493 return self->iterator();
5496 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5498 char tmp[2]; tmp[1]='\0';
5499 tmp[0]=self->getIJ(tupleId,compoId);
5500 return std::string(tmp);
5503 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5505 char tmp[2]; tmp[1]='\0';
5506 tmp[0]=self->getIJSafe(tupleId,compoId);
5507 return std::string(tmp);
5510 std::string __str__() const throw(INTERP_KERNEL::Exception)
5512 return self->repr();
5515 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5517 const char *vals=self->getConstPointer();
5518 int nbOfComp=self->getNumberOfComponents();
5519 int nbOfTuples=self->getNumberOfTuples();
5520 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5523 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5525 if(PyString_Check(tupl))
5527 Py_ssize_t sz=PyString_Size(tupl);
5528 std::vector<char> vals(sz);
5529 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5530 return self->presenceOfTuple(vals);
5533 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5536 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5538 if(PyString_Check(vals))
5540 Py_ssize_t sz=PyString_Size(vals);
5541 std::vector<char> vals2(sz);
5542 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5543 return self->presenceOfValue(vals2);
5546 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5549 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5551 if(PyString_Check(vals))
5553 Py_ssize_t sz=PyString_Size(vals);
5554 std::vector<char> vals2(sz);
5555 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5556 return self->findIdFirstEqual(vals2);
5559 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5562 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5564 if(PyString_Check(tupl))
5566 Py_ssize_t sz=PyString_Size(tupl);
5567 std::vector<char> vals(sz);
5568 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5569 return self->findIdFirstEqualTuple(vals);
5572 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5575 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5577 if(PyString_Check(strOrListOfInt))
5579 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5580 std::vector<char> vals(sz);
5581 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5582 return self->findIdSequence(vals);
5585 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5588 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5590 int sz=self->getNumberOfComponents();
5591 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5592 self->getTuple(tupleId,tmp);
5593 return PyString_FromString(tmp);
5596 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5599 char tmp2[2]; tmp2[1]='\0';
5600 tmp2[0]=self->getMaxValue(tmp);
5601 PyObject *ret=PyTuple_New(2);
5602 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5603 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5607 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5610 char tmp2[2]; tmp2[1]='\0';
5611 tmp2[0]=self->getMinValue(tmp);
5612 PyObject *ret=PyTuple_New(2);
5613 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5614 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5618 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5620 int nbOfCompo=self->getNumberOfComponents();
5625 if(PyString_Check(obj))
5627 Py_ssize_t sz=PyString_Size(obj);
5628 char *pt=PyString_AsString(obj);
5630 return self->findIdFirstEqual(pt[0]);
5632 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5635 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5638 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5642 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5644 int nbOfCompo=self->getNumberOfComponents();
5651 if(PyString_Check(obj))
5653 Py_ssize_t sz=PyString_Size(obj);
5654 char *pt=PyString_AsString(obj);
5656 return self->presenceOfValue(pt[0]);
5658 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5661 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5664 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5668 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5671 std::vector<int> stdvecTyyppArr;
5672 std::pair<int, std::pair<int,int> > sTyyppArr;
5673 MEDCoupling::DataArrayInt *daIntTyypp=0;
5674 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5678 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5680 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5682 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5684 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5686 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5690 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5692 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.";
5694 std::vector<int> stdvecTyyppArr;
5695 std::pair<int, std::pair<int,int> > sTyyppArr;
5696 MEDCoupling::DataArrayInt *daIntTyypp=0;
5697 int nbOfCompo=self->getNumberOfComponents();
5698 int nbOfTuples=self->getNumberOfTuples();
5699 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5701 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5702 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5711 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5717 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5718 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5721 //value vector<string>
5724 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5725 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5728 //value DataArrayChar
5731 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5735 throw INTERP_KERNEL::Exception(msg);
5739 {//obj list-tuple[int]
5745 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5751 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5752 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5755 //value vector<string>
5758 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5759 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5762 //value DataArrayChar
5765 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5769 throw INTERP_KERNEL::Exception(msg);
5780 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5786 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5787 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5790 //value vector<string>
5793 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5794 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5797 //value DataArrayChar
5800 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5804 throw INTERP_KERNEL::Exception(msg);
5815 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5821 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5822 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5825 //value vector<string>
5828 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5829 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5832 //value DataArrayChar
5835 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5839 throw INTERP_KERNEL::Exception(msg);
5844 throw INTERP_KERNEL::Exception(msg);
5850 class DataArrayAsciiCharTuple;
5852 class DataArrayAsciiCharIterator
5855 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5856 ~DataArrayAsciiCharIterator();
5861 DataArrayAsciiCharTuple *ret=self->nextt();
5863 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5866 PyErr_SetString(PyExc_StopIteration,"No more data.");
5873 class DataArrayAsciiCharTuple
5876 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5877 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5880 std::string __str__() const throw(INTERP_KERNEL::Exception)
5882 return self->repr();
5885 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5887 return self->buildDAAsciiChar(1,self->getNumberOfCompo());