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::DataArrayFloat::Meld;
71 %newobject MEDCoupling::DataArrayInt::New;
72 %newobject MEDCoupling::DataArrayInt::__iter__;
73 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
74 %newobject MEDCoupling::DataArrayInt::subArray;
75 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
76 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
77 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
78 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
79 %newobject MEDCoupling::DataArrayInt::renumber;
80 %newobject MEDCoupling::DataArrayInt::renumberR;
81 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
82 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
83 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
84 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
85 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
86 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
87 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
88 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
89 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
90 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
91 %newobject MEDCoupling::DataArrayInt::negate;
92 %newobject MEDCoupling::DataArrayInt::computeAbs;
93 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
94 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
95 %newobject MEDCoupling::DataArrayInt::findIdsStrictlyNegative;
96 %newobject MEDCoupling::DataArrayInt::Aggregate;
97 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
98 %newobject MEDCoupling::DataArrayInt::Meld;
99 %newobject MEDCoupling::DataArrayInt::Add;
100 %newobject MEDCoupling::DataArrayInt::Substract;
101 %newobject MEDCoupling::DataArrayInt::Multiply;
102 %newobject MEDCoupling::DataArrayInt::Divide;
103 %newobject MEDCoupling::DataArrayInt::Pow;
104 %newobject MEDCoupling::DataArrayInt::BuildUnion;
105 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
106 %newobject MEDCoupling::DataArrayInt::Range;
107 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
108 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
109 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
110 %newobject MEDCoupling::DataArrayInt::buildComplement;
111 %newobject MEDCoupling::DataArrayInt::buildUnion;
112 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
113 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
114 %newobject MEDCoupling::DataArrayInt::buildIntersection;
115 %newobject MEDCoupling::DataArrayInt::buildUnique;
116 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
117 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
118 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
119 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
120 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
121 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
122 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
123 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
124 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
125 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
126 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
127 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
128 %newobject MEDCoupling::DataArrayInt::__neg__;
129 %newobject MEDCoupling::DataArrayInt::__add__;
130 %newobject MEDCoupling::DataArrayInt::__radd__;
131 %newobject MEDCoupling::DataArrayInt::__sub__;
132 %newobject MEDCoupling::DataArrayInt::__rsub__;
133 %newobject MEDCoupling::DataArrayInt::__mul__;
134 %newobject MEDCoupling::DataArrayInt::__rmul__;
135 %newobject MEDCoupling::DataArrayInt::__div__;
136 %newobject MEDCoupling::DataArrayInt::__rdiv__;
137 %newobject MEDCoupling::DataArrayInt::__mod__;
138 %newobject MEDCoupling::DataArrayInt::__rmod__;
139 %newobject MEDCoupling::DataArrayInt::__pow__;
140 %newobject MEDCoupling::DataArrayInt::__rpow__;
141 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
142 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
143 %newobject MEDCoupling::DataArrayChar::renumber;
144 %newobject MEDCoupling::DataArrayChar::renumberR;
145 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
146 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
147 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
148 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
149 %newobject MEDCoupling::DataArrayChar::Aggregate;
150 %newobject MEDCoupling::DataArrayChar::Meld;
151 %newobject MEDCoupling::DataArrayByte::New;
152 %newobject MEDCoupling::DataArrayByte::__iter__;
153 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
154 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
155 %newobject MEDCoupling::DataArrayChar::subArray;
156 %newobject MEDCoupling::DataArrayAsciiChar::New;
157 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
158 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
159 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
160 %newobject MEDCoupling::DataArrayDouble::New;
161 %newobject MEDCoupling::DataArrayDouble::__iter__;
162 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
163 %newobject MEDCoupling::DataArrayDouble::Aggregate;
164 %newobject MEDCoupling::DataArrayDouble::Meld;
165 %newobject MEDCoupling::DataArrayDouble::Dot;
166 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
167 %newobject MEDCoupling::DataArrayDouble::Add;
168 %newobject MEDCoupling::DataArrayDouble::Substract;
169 %newobject MEDCoupling::DataArrayDouble::Multiply;
170 %newobject MEDCoupling::DataArrayDouble::Divide;
171 %newobject MEDCoupling::DataArrayDouble::Pow;
172 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
173 %newobject MEDCoupling::DataArrayDouble::subArray;
174 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
175 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
176 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
177 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
178 %newobject MEDCoupling::DataArrayDouble::findIdsStrictlyNegative;
179 %newobject MEDCoupling::DataArrayDouble::negate;
180 %newobject MEDCoupling::DataArrayDouble::computeAbs;
181 %newobject MEDCoupling::DataArrayDouble::applyFunc;
182 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
183 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
184 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
185 %newobject MEDCoupling::DataArrayDouble::determinant;
186 %newobject MEDCoupling::DataArrayDouble::eigenValues;
187 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
188 %newobject MEDCoupling::DataArrayDouble::inverse;
189 %newobject MEDCoupling::DataArrayDouble::trace;
190 %newobject MEDCoupling::DataArrayDouble::deviator;
191 %newobject MEDCoupling::DataArrayDouble::magnitude;
192 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
193 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
194 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
195 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
196 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
197 %newobject MEDCoupling::DataArrayDouble::renumber;
198 %newobject MEDCoupling::DataArrayDouble::renumberR;
199 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
200 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
201 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
202 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
203 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
204 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
205 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
206 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
207 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
208 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
209 %newobject MEDCoupling::DataArrayDouble::cartesianize;
210 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
211 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
212 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
213 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
214 %newobject MEDCoupling::DataArrayDouble::__neg__;
215 %newobject MEDCoupling::DataArrayDouble::__radd__;
216 %newobject MEDCoupling::DataArrayDouble::__rsub__;
217 %newobject MEDCoupling::DataArrayDouble::__rmul__;
218 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
219 %newobject MEDCoupling::DataArrayDouble::__pow__;
220 %newobject MEDCoupling::DataArrayDouble::__rpow__;
221 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
223 %newobject MEDCoupling::PartDefinition::New;
224 %newobject MEDCoupling::PartDefinition::toDAI;
225 %newobject MEDCoupling::PartDefinition::__add__;
226 %newobject MEDCoupling::PartDefinition::composeWith;
227 %newobject MEDCoupling::PartDefinition::tryToSimplify;
228 %newobject MEDCoupling::DataArrayPartDefinition::New;
229 %newobject MEDCoupling::SlicePartDefinition::New;
232 %feature("unref") DataArray "$this->decrRef();"
233 %feature("unref") DataArrayDouble "$this->decrRef();"
234 %feature("unref") DataArrayInt "$this->decrRef();"
235 %feature("unref") DataArrayChar "$this->decrRef();"
236 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
237 %feature("unref") DataArrayByte "$this->decrRef();"
239 %feature("unref") PartDefinition "$this->decrRef();"
240 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
241 %feature("unref") SlicePartDefinition "$this->decrRef();"
243 namespace MEDCoupling
250 } MEDCouplingAxisType;
254 class PartDefinition : public RefCountObject, public TimeLabel
257 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
258 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
259 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
260 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
261 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
262 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
263 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
264 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
267 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
269 return (*self)+other;
272 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
275 bool ret0(self->isEqual(other,ret1));
276 PyObject *ret=PyTuple_New(2);
277 PyObject *ret0Py=ret0?Py_True:Py_False;
279 PyTuple_SetItem(ret,0,ret0Py);
280 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
284 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
286 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
290 virtual ~PartDefinition();
293 class DataArrayPartDefinition : public PartDefinition
296 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
299 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
301 return DataArrayPartDefinition::New(listOfIds);
304 std::string __str__() const throw(INTERP_KERNEL::Exception)
306 return self->getRepr();
309 std::string __repr__() const throw(INTERP_KERNEL::Exception)
311 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
312 oss << self->getRepr();
317 virtual ~DataArrayPartDefinition();
320 class SlicePartDefinition : public PartDefinition
323 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
324 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
327 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
329 return SlicePartDefinition::New(start,stop,step);
332 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
335 self->getSlice(a,b,c);
336 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
339 std::string __str__() const throw(INTERP_KERNEL::Exception)
341 return self->getRepr();
344 std::string __repr__() const throw(INTERP_KERNEL::Exception)
346 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
347 oss << self->getRepr();
352 virtual ~SlicePartDefinition();
355 class DataArray : public RefCountObject, public TimeLabel
358 void setName(const std::string& name);
359 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
360 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
361 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
362 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
363 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
364 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
365 std::string getName() const;
366 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
367 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
368 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
369 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
370 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
371 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
372 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
373 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
374 int getNumberOfComponents() const;
375 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
376 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
377 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
378 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
379 virtual void desallocate() throw(INTERP_KERNEL::Exception);
380 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
381 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
382 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
383 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
384 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
385 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
386 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
387 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
388 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
389 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
390 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
391 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
392 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
393 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
394 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
395 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
396 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
397 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
398 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
399 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
400 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
401 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
402 void updateTime() const;
405 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
407 const std::vector<std::string>& comps=self->getInfoOnComponents();
408 PyObject *ret=PyList_New((int)comps.size());
409 for(int i=0;i<(int)comps.size();i++)
410 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
414 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
416 std::vector<int> tmp;
417 convertPyToNewIntArr3(li,tmp);
418 self->copyPartOfStringInfoFrom(other,tmp);
421 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
423 std::vector<int> tmp;
424 convertPyToNewIntArr3(li,tmp);
425 self->copyPartOfStringInfoFrom2(tmp,other);
428 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
431 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
432 if (!SWIG_IsOK(res1))
435 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
436 if(size!=self->getNumberOfTuples())
438 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
440 self->renumberInPlace(tmp);
444 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
446 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
447 da2->checkAllocated();
448 int size=self->getNumberOfTuples();
449 if(size!=self->getNumberOfTuples())
451 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
453 self->renumberInPlace(da2->getConstPointer());
457 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
460 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
461 if (!SWIG_IsOK(res1))
464 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
465 if(size!=self->getNumberOfTuples())
467 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
469 self->renumberInPlaceR(tmp);
473 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
475 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
476 da2->checkAllocated();
477 int size=self->getNumberOfTuples();
478 if(size!=self->getNumberOfTuples())
480 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
482 self->renumberInPlaceR(da2->getConstPointer());
486 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
487 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
489 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
490 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
491 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
492 DataArrayInt *tuplesSelecPtr2=0;
495 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
497 throw INTERP_KERNEL::Exception(msg);
499 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
502 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
504 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
505 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
508 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
510 std::vector<std::pair<int,int> > ranges;
511 convertPyToVectorPairInt(li,ranges);
512 return self->selectByTupleRanges(ranges);
515 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
518 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
519 if (!SWIG_IsOK(res1))
522 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
523 return self->selectByTupleId(tmp,tmp+size);
527 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
529 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
530 da2->checkAllocated();
531 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
535 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
538 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
539 if (!SWIG_IsOK(res1))
542 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
543 return self->selectByTupleIdSafe(tmp,tmp+size);
547 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
549 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
550 da2->checkAllocated();
551 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
555 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
557 std::vector<int> tmp;
558 convertPyToNewIntArr3(li,tmp);
559 DataArray *ret=self->keepSelectedComponents(tmp);
560 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
563 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
565 if(!PySlice_Check(slic))
566 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
567 Py_ssize_t strt=2,stp=2,step=2;
568 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
569 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
571 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
572 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
575 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
577 if(!PySlice_Check(slic))
578 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
579 Py_ssize_t strt=2,stp=2,step=2;
580 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
581 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
583 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
584 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
587 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
589 if(!PySlice_Check(slic))
590 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
591 Py_ssize_t strt=2,stp=2,step=2;
592 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
593 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
594 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
597 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
599 if(!PySlice_Check(slic))
600 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
601 Py_ssize_t strt=2,stp=2,step=2;
602 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
603 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
604 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
607 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
609 std::vector<const DataArray *> tmp;
610 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
611 return DataArray::Aggregate(tmp);
614 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
616 if(!PySlice_Check(slic))
617 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
618 Py_ssize_t strt=2,stp=2,step=2;
619 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
620 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
621 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
624 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
626 if(!PySlice_Check(slic))
627 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
628 Py_ssize_t strt=2,stp=2,step=2;
629 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
630 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
631 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
634 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
636 PyObject *ret(PyTuple_New(2));
637 std::string a0(self->getName());
638 const std::vector<std::string> &a1(self->getInfoOnComponents());
639 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
642 PyObject *ret1(PyList_New(sz));
643 for(int i=0;i<sz;i++)
644 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
645 PyTuple_SetItem(ret,1,ret1);
650 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
652 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 !";
653 if(!PyTuple_Check(inp))
654 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
655 int sz(PyTuple_Size(inp));
657 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
658 PyObject *a0(PyTuple_GetItem(inp,0));
659 if(!PyString_Check(a0))
660 throw INTERP_KERNEL::Exception(MSG);
661 PyObject *a1(PyTuple_GetItem(inp,1));
662 std::vector<std::string> a1cpp;
663 if(!fillStringVector(a1,a1cpp))
664 throw INTERP_KERNEL::Exception(MSG);
665 self->setName(PyString_AsString(a0));
666 self->setInfoOnComponents(a1cpp);
671 class DataArrayDouble;
673 class DataArrayFloat : public DataArray
676 static DataArrayFloat *New();
677 void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
678 bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
679 bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
680 bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
681 void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
682 void iota(float init=0.) throw(INTERP_KERNEL::Exception);
683 DataArrayFloatIterator *iterator() throw(INTERP_KERNEL::Exception);
684 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
685 static DataArrayFloat *Meld(const DataArrayFloat *a1, const DataArrayFloat *a2) throw(INTERP_KERNEL::Exception);
688 DataArrayFloat() throw(INTERP_KERNEL::Exception)
690 return DataArrayFloat::New();
693 static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
695 return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
698 DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
700 return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
703 DataArrayFloatIterator *__iter__() throw(INTERP_KERNEL::Exception)
705 return self->iterator();
708 std::string __repr__() const throw(INTERP_KERNEL::Exception)
710 std::ostringstream oss;
711 self->reprQuickOverview(oss);
715 std::string __str__() const throw(INTERP_KERNEL::Exception)
717 return self->reprNotTooLong();
720 int __len__() const throw(INTERP_KERNEL::Exception)
722 if(self->isAllocated())
724 return self->getNumberOfTuples();
728 throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
732 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
734 const float *vals(self->begin());
735 return convertDblArrToPyList<float>(vals,self->getNbOfElems());
738 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
740 const float *vals(self->begin());
741 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
742 return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
745 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
747 return DataArrayT__getitem<float>(self,obj);
750 DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
752 return DataArrayT__setitem__<float>(self,obj,value);
755 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
757 return DataArrayT_iadd<float>(trueSelf,obj,self);
760 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
762 return DataArrayT_isub<float>(trueSelf,obj,self);
765 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
767 return DataArrayT_imul<float>(trueSelf,obj,self);
770 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
772 return DataArrayT_idiv<float>(trueSelf,obj,self);
776 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
778 return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
783 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
785 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayFloat");
788 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
791 if(!self->isAllocated())
792 throw INTERP_KERNEL::Exception("PyWrap of DataArrayFloat.__getnewargs__ : self is not allocated !");
793 PyObject *ret(PyTuple_New(1));
794 PyObject *ret0(PyDict_New());
795 PyObject *numpyArryObj(MEDCoupling_DataArrayFloat_toNumPyArray(self));
796 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
797 PyObject *tmp1(PyInt_FromLong(0));
798 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
799 PyTuple_SetItem(ret,0,ret0);
803 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
809 class DataArrayFloatTuple;
811 class DataArrayFloatIterator
814 DataArrayFloatIterator(DataArrayFloat *da);
815 ~DataArrayFloatIterator();
820 DataArrayFloatTuple *ret=self->nextt();
822 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple,SWIG_POINTER_OWN|0);
825 PyErr_SetString(PyExc_StopIteration,"No more data.");
832 class DataArrayFloatTuple
835 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
836 DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
839 std::string __str__() const throw(INTERP_KERNEL::Exception)
844 float __float__() const throw(INTERP_KERNEL::Exception)
846 return self->floatValue();
849 DataArrayFloat *buildDAFloat() throw(INTERP_KERNEL::Exception)
851 return self->buildDAFloat(1,self->getNumberOfCompo());
854 /*PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
856 MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
857 MEDCoupling_DataArrayFloat____imul___(ret,0,obj);
858 Py_XINCREF(trueSelf);
862 PyObject *__len__() throw(INTERP_KERNEL::Exception)
864 return PyInt_FromLong(self->getNumberOfCompo());
870 class DataArrayDoubleIterator;
872 class DataArrayDouble : public DataArray
875 static DataArrayDouble *New();
876 double doubleValue() const throw(INTERP_KERNEL::Exception);
877 bool empty() const throw(INTERP_KERNEL::Exception);
878 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
879 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
880 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
881 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
882 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
883 double popBackSilent() throw(INTERP_KERNEL::Exception);
884 void pack() const throw(INTERP_KERNEL::Exception);
885 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
886 void fillWithZero() throw(INTERP_KERNEL::Exception);
887 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
888 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
889 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
890 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
891 void reverse() throw(INTERP_KERNEL::Exception);
892 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
893 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
894 std::string repr() const throw(INTERP_KERNEL::Exception);
895 std::string reprZip() const throw(INTERP_KERNEL::Exception);
896 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
897 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
898 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
899 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
900 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
901 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
902 void transpose() throw(INTERP_KERNEL::Exception);
903 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
904 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
905 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
906 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
907 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
908 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
909 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
910 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
911 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
912 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
913 double front() const throw(INTERP_KERNEL::Exception);
914 double back() const throw(INTERP_KERNEL::Exception);
915 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
916 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
917 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
918 double *getPointer() throw(INTERP_KERNEL::Exception);
919 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
920 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
921 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
922 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
923 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
924 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
925 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
926 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
927 double getAverageValue() const throw(INTERP_KERNEL::Exception);
928 double norm2() const throw(INTERP_KERNEL::Exception);
929 double normMax() const throw(INTERP_KERNEL::Exception);
930 double normMin() const throw(INTERP_KERNEL::Exception);
931 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
932 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
933 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
934 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
935 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
936 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
937 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
938 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
939 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
940 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
941 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
942 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
943 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
944 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
945 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
946 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
947 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
948 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
949 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
950 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
951 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
952 void abs() throw(INTERP_KERNEL::Exception);
953 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
954 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
955 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
956 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
957 void applyPow(double val) throw(INTERP_KERNEL::Exception);
958 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
959 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
960 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
961 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
962 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
963 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
964 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
965 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
966 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
967 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
968 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
969 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
970 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
971 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
972 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
973 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
974 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
975 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
976 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
977 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
978 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
979 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
980 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
981 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
982 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
983 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
984 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
985 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
986 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
987 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
988 MCAuto<DataArrayInt> findIdsGreaterThan(double val) const throw(INTERP_KERNEL::Exception);
989 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
990 MCAuto<DataArrayInt> findIdsLowerThan(double val) const throw(INTERP_KERNEL::Exception);
991 MCAuto<DataArrayInt> convertToIntArr() const throw(INTERP_KERNEL::Exception);
992 MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
993 MCAuto<DataArrayDouble> cumSum() const throw(INTERP_KERNEL::Exception);
994 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
997 DataArrayDouble() throw(INTERP_KERNEL::Exception)
999 return DataArrayDouble::New();
1002 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1004 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
1007 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1009 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
1012 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
1015 std::vector<double> bb;
1017 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
1018 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
1019 self->pushBackValsSilent(tmp,tmp+nbTuples);
1022 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1024 std::ostringstream oss;
1025 self->reprQuickOverview(oss);
1029 std::string __str__() const throw(INTERP_KERNEL::Exception)
1031 return self->reprNotTooLong();
1034 double __float__() const throw(INTERP_KERNEL::Exception)
1036 return self->doubleValue();
1039 int __len__() const throw(INTERP_KERNEL::Exception)
1041 if(self->isAllocated())
1043 return self->getNumberOfTuples();
1047 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
1051 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
1053 return self->iterator();
1056 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1058 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 !";
1059 if(PyList_Check(li) || PyTuple_Check(li))
1063 if(PyInt_Check(nbOfTuples))
1065 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1067 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
1070 if(PyInt_Check(nbOfComp))
1071 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
1072 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1074 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
1075 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
1076 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1079 throw INTERP_KERNEL::Exception(msg);
1082 {//DataArrayDouble.setValues([1.,3.,4.],3)
1084 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
1085 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1089 throw INTERP_KERNEL::Exception(msg);
1092 {// DataArrayDouble.setValues([1.,3.,4.])
1093 int tmpp1=-1,tmpp2=-1;
1094 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
1095 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1099 throw INTERP_KERNEL::Exception(msg);
1102 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
1104 const double *vals(self->begin());
1105 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
1109 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
1111 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1115 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1118 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1119 PyObject *ret=PyTuple_New(2);
1120 PyObject *ret0Py=ret0?Py_True:Py_False;
1122 PyTuple_SetItem(ret,0,ret0Py);
1123 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1127 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1129 const double *vals(self->begin());
1130 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1131 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1134 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1136 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1138 DataArrayDouble *a,*a2;
1139 DataArrayDoubleTuple *aa,*aa2;
1140 std::vector<double> bb,bb2;
1142 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1143 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1144 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1148 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1150 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1152 DataArrayDouble *a,*a2;
1153 DataArrayDoubleTuple *aa,*aa2;
1154 std::vector<double> bb,bb2;
1156 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1158 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1159 return convertDblArrToPyListOfTuple<double>(res,3,3);
1162 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1164 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1166 DataArrayDouble *a,*a2;
1167 DataArrayDoubleTuple *aa,*aa2;
1168 std::vector<double> bb,bb2;
1170 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1171 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1172 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1175 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1178 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1179 if (!SWIG_IsOK(res1))
1182 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1183 if(size!=self->getNumberOfTuples())
1185 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1187 return self->renumber(tmp);
1191 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1193 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1194 da2->checkAllocated();
1195 int size=self->getNumberOfTuples();
1196 if(size!=self->getNumberOfTuples())
1198 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1200 return self->renumber(da2->getConstPointer());
1204 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1207 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1208 if (!SWIG_IsOK(res1))
1211 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1212 if(size!=self->getNumberOfTuples())
1214 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1216 return self->renumberR(tmp);
1220 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1222 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1223 da2->checkAllocated();
1224 int size=self->getNumberOfTuples();
1225 if(size!=self->getNumberOfTuples())
1227 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1229 return self->renumberR(da2->getConstPointer());
1233 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1236 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1237 if (!SWIG_IsOK(res1))
1240 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1241 if(size!=self->getNumberOfTuples())
1243 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1245 return self->renumberAndReduce(tmp,newNbOfTuple);
1249 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1251 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1252 da2->checkAllocated();
1253 int size=self->getNumberOfTuples();
1254 if(size!=self->getNumberOfTuples())
1256 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1258 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1262 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1264 int thisTupleId,otherTupleId;
1265 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1266 PyObject *ret=PyTuple_New(3);
1267 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1268 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1269 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1273 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1276 double r1=self->getMaxValue(tmp);
1277 PyObject *ret=PyTuple_New(2);
1278 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1279 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1283 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1286 double r1=self->getMaxValue2(tmp);
1287 PyObject *ret=PyTuple_New(2);
1288 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1289 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1293 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1296 double r1=self->getMinValue(tmp);
1297 PyObject *ret=PyTuple_New(2);
1298 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1299 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1303 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1306 double r1=self->getMinValue2(tmp);
1307 PyObject *ret=PyTuple_New(2);
1308 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1309 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1313 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1315 int nbOfCompo(self->getNumberOfComponents());
1316 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1317 self->getMinMaxPerComponent(tmp);
1318 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1322 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1324 int sz=self->getNumberOfComponents();
1325 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1326 self->accumulate(tmp);
1327 return convertDblArrToPyList<double>(tmp,sz);
1330 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1333 std::vector<int> val2;
1334 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1335 return self->accumulatePerChunck(bg,bg+sz);
1338 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1340 DataArrayInt *comm, *commIndex;
1341 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1342 PyObject *res = PyList_New(2);
1343 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1344 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1348 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1352 DataArrayDoubleTuple *aa;
1353 std::vector<double> bb;
1355 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1356 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1358 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1359 PyObject *ret=PyTuple_New(2);
1360 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1361 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1365 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1367 std::vector<int> tmp;
1368 convertPyToNewIntArr3(li,tmp);
1369 self->setSelectedComponents(a,tmp);
1372 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1374 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1375 std::size_t sz(retCpp.size());
1376 PyObject *res(PyList_New(sz));
1377 for(std::size_t i=0;i<sz;i++)
1378 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1382 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1384 int sz=self->getNumberOfComponents();
1385 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1386 self->getTuple(tupleId,tmp);
1387 return convertDblArrToPyList<double>(tmp,sz);
1390 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1392 std::vector<const DataArrayDouble *> tmp;
1393 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1394 return DataArrayDouble::Aggregate(tmp);
1397 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1399 std::vector<const DataArrayDouble *> tmp;
1400 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1401 return DataArrayDouble::Meld(tmp);
1404 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1408 DataArrayDoubleTuple *aa;
1409 std::vector<double> bb;
1411 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1412 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1413 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1414 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1415 DataArrayInt *c=0,*cI=0;
1416 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1417 PyObject *ret=PyTuple_New(2);
1418 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1419 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1423 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1425 DataArrayInt *ret1=0;
1426 bool ret0=self->areIncludedInMe(other,prec,ret1);
1427 PyObject *ret=PyTuple_New(2);
1428 PyObject *ret0Py=ret0?Py_True:Py_False;
1430 PyTuple_SetItem(ret,0,ret0Py);
1431 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1435 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1437 return DataArrayT__getitem<double>(self,obj);
1440 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1442 return DataArrayT__setitem__<double>(self,obj,value);
1445 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1447 return self->negate();
1450 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1452 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1455 DataArrayDoubleTuple *aa;
1456 std::vector<double> bb;
1459 #ifndef WITHOUT_AUTOFIELD
1461 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1463 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1466 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1467 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1469 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1472 throw INTERP_KERNEL::Exception(msg);
1476 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1481 MCAuto<DataArrayDouble> ret=self->deepCopy();
1482 ret->applyLin(1.,val);
1483 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1487 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1491 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1492 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1496 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1497 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1500 throw INTERP_KERNEL::Exception(msg);
1504 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1506 const char msg[]="Unexpected situation in __radd__ !";
1509 DataArrayDoubleTuple *aa;
1510 std::vector<double> bb;
1512 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1517 MCAuto<DataArrayDouble> ret=self->deepCopy();
1518 ret->applyLin(1.,val);
1523 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1524 return DataArrayDouble::Add(self,aaa);
1528 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1529 return DataArrayDouble::Add(self,aaa);
1532 throw INTERP_KERNEL::Exception(msg);
1536 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1538 return DataArrayT_iadd<double>(trueSelf,obj,self);
1541 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1543 const char msg[]="Unexpected situation in __sub__ !";
1546 DataArrayDoubleTuple *aa;
1547 std::vector<double> bb;
1550 #ifndef WITHOUT_AUTOFIELD
1552 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1554 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1557 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1558 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1560 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1563 throw INTERP_KERNEL::Exception(msg);
1567 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1572 MCAuto<DataArrayDouble> ret=self->deepCopy();
1573 ret->applyLin(1.,-val);
1574 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1578 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1582 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1583 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1587 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1588 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1591 throw INTERP_KERNEL::Exception(msg);
1595 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1597 const char msg[]="Unexpected situation in __rsub__ !";
1600 DataArrayDoubleTuple *aa;
1601 std::vector<double> bb;
1603 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1608 MCAuto<DataArrayDouble> ret=self->deepCopy();
1609 ret->applyLin(-1.,val);
1614 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1615 return DataArrayDouble::Substract(aaa,self);
1619 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1620 return DataArrayDouble::Substract(aaa,self);
1623 throw INTERP_KERNEL::Exception(msg);
1627 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1629 return DataArrayT_isub<double>(trueSelf,obj,self);
1632 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1634 const char msg[]="Unexpected situation in __mul__ !";
1637 DataArrayDoubleTuple *aa;
1638 std::vector<double> bb;
1641 #ifndef WITHOUT_AUTOFIELD
1643 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1645 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1648 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1649 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1651 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1654 throw INTERP_KERNEL::Exception(msg);
1658 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1663 MCAuto<DataArrayDouble> ret=self->deepCopy();
1664 ret->applyLin(val,0.);
1665 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1669 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1673 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1674 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1678 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1679 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1682 throw INTERP_KERNEL::Exception(msg);
1686 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1688 const char msg[]="Unexpected situation in __rmul__ !";
1691 DataArrayDoubleTuple *aa;
1692 std::vector<double> bb;
1694 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1699 MCAuto<DataArrayDouble> ret=self->deepCopy();
1700 ret->applyLin(val,0.);
1705 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1706 return DataArrayDouble::Multiply(self,aaa);
1710 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1711 return DataArrayDouble::Multiply(self,aaa);
1714 throw INTERP_KERNEL::Exception(msg);
1718 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1720 return DataArrayT_imul<double>(trueSelf,obj,self);
1723 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1725 const char msg[]="Unexpected situation in __div__ !";
1728 DataArrayDoubleTuple *aa;
1729 std::vector<double> bb;
1732 #ifndef WITHOUT_AUTOFIELD
1734 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1736 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1739 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1740 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1742 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1745 throw INTERP_KERNEL::Exception(msg);
1749 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1755 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1756 MCAuto<DataArrayDouble> ret=self->deepCopy();
1757 ret->applyLin(1/val,0.);
1758 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1762 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1766 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1767 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1771 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1772 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1775 throw INTERP_KERNEL::Exception(msg);
1779 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1781 const char msg[]="Unexpected situation in __rdiv__ !";
1784 DataArrayDoubleTuple *aa;
1785 std::vector<double> bb;
1787 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1792 MCAuto<DataArrayDouble> ret=self->deepCopy();
1798 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1799 return DataArrayDouble::Divide(aaa,self);
1803 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1804 return DataArrayDouble::Divide(aaa,self);
1807 throw INTERP_KERNEL::Exception(msg);
1811 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1813 return DataArrayT_idiv<double>(trueSelf,obj,self);
1816 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1818 const char msg[]="Unexpected situation in __pow__ !";
1821 DataArrayDoubleTuple *aa;
1822 std::vector<double> bb;
1824 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1829 MCAuto<DataArrayDouble> ret=self->deepCopy();
1835 return DataArrayDouble::Pow(self,a);
1839 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1840 return DataArrayDouble::Pow(self,aaa);
1844 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1845 return DataArrayDouble::Pow(self,aaa);
1848 throw INTERP_KERNEL::Exception(msg);
1852 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1854 const char msg[]="Unexpected situation in __rpow__ !";
1857 DataArrayDoubleTuple *aa;
1858 std::vector<double> bb;
1860 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1865 MCAuto<DataArrayDouble> ret=self->deepCopy();
1866 ret->applyRPow(val);
1871 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1872 return DataArrayDouble::Pow(aaa,self);
1876 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1877 return DataArrayDouble::Pow(aaa,self);
1880 throw INTERP_KERNEL::Exception(msg);
1884 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1886 const char msg[]="Unexpected situation in __ipow__ !";
1889 DataArrayDoubleTuple *aa;
1890 std::vector<double> bb;
1892 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1897 self->applyPow(val);
1898 Py_XINCREF(trueSelf);
1904 Py_XINCREF(trueSelf);
1909 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1910 self->powEqual(aaa);
1911 Py_XINCREF(trueSelf);
1916 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1917 self->powEqual(aaa);
1918 Py_XINCREF(trueSelf);
1922 throw INTERP_KERNEL::Exception(msg);
1926 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1928 DataArrayInt *c=0,*cI=0;
1930 self->computeTupleIdsNearTuples(other,eps,c,cI);
1931 PyObject *ret=PyTuple_New(2);
1932 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1933 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1937 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1939 DataArrayInt *ret1=0;
1940 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1941 PyObject *ret=PyTuple_New(2);
1942 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1943 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1948 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
1950 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
1953 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
1956 if(!self->isAllocated())
1957 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
1958 PyObject *ret(PyTuple_New(1));
1959 PyObject *ret0(PyDict_New());
1960 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
1961 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
1962 PyObject *tmp1(PyInt_FromLong(0));
1963 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
1964 PyTuple_SetItem(ret,0,ret0);
1968 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
1974 class DataArrayDoubleTuple;
1976 class DataArrayDoubleIterator
1979 DataArrayDoubleIterator(DataArrayDouble *da);
1980 ~DataArrayDoubleIterator();
1985 DataArrayDoubleTuple *ret=self->nextt();
1987 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1990 PyErr_SetString(PyExc_StopIteration,"No more data.");
1997 class DataArrayDoubleTuple
2000 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2001 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2004 std::string __str__() const throw(INTERP_KERNEL::Exception)
2006 return self->repr();
2009 double __float__() const throw(INTERP_KERNEL::Exception)
2011 return self->doubleValue();
2014 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2016 return self->buildDADouble(1,self->getNumberOfCompo());
2019 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2021 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2022 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2023 Py_XINCREF(trueSelf);
2027 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2029 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2030 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2031 Py_XINCREF(trueSelf);
2035 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2037 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2038 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2039 Py_XINCREF(trueSelf);
2043 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2045 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2046 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2047 Py_XINCREF(trueSelf);
2051 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2053 return PyInt_FromLong(self->getNumberOfCompo());
2056 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2058 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2061 std::vector<int> multiVal;
2062 std::pair<int, std::pair<int,int> > slic;
2063 MEDCoupling::DataArrayInt *daIntTyypp=0;
2064 const double *pt=self->getConstPointer();
2065 int nbc=self->getNumberOfCompo();
2066 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2073 std::ostringstream oss;
2074 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2075 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2079 return PyFloat_FromDouble(pt[singleVal]);
2083 return PyFloat_FromDouble(pt[nbc+singleVal]);
2086 std::ostringstream oss;
2087 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2088 throw INTERP_KERNEL::Exception(oss.str().c_str());
2094 PyObject *t=PyTuple_New(multiVal.size());
2095 for(int j=0;j<(int)multiVal.size();j++)
2097 int cid=multiVal[j];
2100 std::ostringstream oss;
2101 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2102 throw INTERP_KERNEL::Exception(oss.str().c_str());
2104 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2110 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2111 PyObject *t=PyTuple_New(sz);
2112 for(int j=0;j<sz;j++)
2113 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2117 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2121 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2123 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2124 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2127 std::vector<double> multiValV;
2128 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2129 int nbc=self->getNumberOfCompo();
2130 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2132 std::vector<int> multiVal;
2133 std::pair<int, std::pair<int,int> > slic;
2134 MEDCoupling::DataArrayInt *daIntTyypp=0;
2135 double *pt=self->getPointer();
2136 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2143 std::ostringstream oss;
2144 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2145 throw INTERP_KERNEL::Exception(oss.str().c_str());
2151 pt[singleVal]=singleValV;
2156 if(multiValV.size()!=1)
2158 std::ostringstream oss;
2159 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2160 throw INTERP_KERNEL::Exception(oss.str().c_str());
2162 pt[singleVal]=multiValV[0];
2167 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2171 throw INTERP_KERNEL::Exception(msg);
2180 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2184 std::ostringstream oss;
2185 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2186 throw INTERP_KERNEL::Exception(oss.str().c_str());
2194 if(multiVal.size()!=multiValV.size())
2196 std::ostringstream oss;
2197 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2198 throw INTERP_KERNEL::Exception(oss.str().c_str());
2200 for(int i=0;i<(int)multiVal.size();i++)
2202 int pos=multiVal[i];
2205 std::ostringstream oss;
2206 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2207 throw INTERP_KERNEL::Exception(oss.str().c_str());
2209 pt[multiVal[i]]=multiValV[i];
2215 const double *ptV=daIntTyyppV->getConstPointer();
2216 if(nbc>daIntTyyppV->getNumberOfCompo())
2218 std::ostringstream oss;
2219 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2220 throw INTERP_KERNEL::Exception(oss.str().c_str());
2222 std::copy(ptV,ptV+nbc,pt);
2226 throw INTERP_KERNEL::Exception(msg);
2231 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2236 for(int j=0;j<sz;j++)
2237 pt[slic.first+j*slic.second.second]=singleValV;
2242 if(sz!=(int)multiValV.size())
2244 std::ostringstream oss;
2245 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2246 throw INTERP_KERNEL::Exception(oss.str().c_str());
2248 for(int j=0;j<sz;j++)
2249 pt[slic.first+j*slic.second.second]=multiValV[j];
2254 const double *ptV=daIntTyyppV->getConstPointer();
2255 if(sz>daIntTyyppV->getNumberOfCompo())
2257 std::ostringstream oss;
2258 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2259 throw INTERP_KERNEL::Exception(oss.str().c_str());
2261 for(int j=0;j<sz;j++)
2262 pt[slic.first+j*slic.second.second]=ptV[j];
2266 throw INTERP_KERNEL::Exception(msg);
2270 throw INTERP_KERNEL::Exception(msg);
2276 class DataArrayIntIterator;
2278 class DataArrayInt : public DataArray
2281 static DataArrayInt *New();
2282 int intValue() const throw(INTERP_KERNEL::Exception);
2283 int getHashCode() const throw(INTERP_KERNEL::Exception);
2284 bool empty() const throw(INTERP_KERNEL::Exception);
2285 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2286 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2287 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2288 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2289 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2290 int popBackSilent() throw(INTERP_KERNEL::Exception);
2291 void pack() const throw(INTERP_KERNEL::Exception);
2292 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2293 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2294 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2295 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2296 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2297 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2298 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2299 void reverse() throw(INTERP_KERNEL::Exception);
2300 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2301 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2302 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2303 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2304 void fillWithZero() throw(INTERP_KERNEL::Exception);
2305 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2306 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2307 std::string repr() const throw(INTERP_KERNEL::Exception);
2308 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2309 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2310 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2311 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2312 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2313 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2314 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2315 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2316 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2317 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2318 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2319 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2320 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2321 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2322 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2323 void transpose() throw(INTERP_KERNEL::Exception);
2324 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2325 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2326 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2327 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2328 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2329 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2330 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2331 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2332 int front() const throw(INTERP_KERNEL::Exception);
2333 int back() const throw(INTERP_KERNEL::Exception);
2334 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2335 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2336 int *getPointer() throw(INTERP_KERNEL::Exception);
2337 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2338 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2339 const int *begin() const throw(INTERP_KERNEL::Exception);
2340 const int *end() const throw(INTERP_KERNEL::Exception);
2341 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2342 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2343 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2344 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2345 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2346 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2347 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2348 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2349 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2350 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2351 int count(int value) const throw(INTERP_KERNEL::Exception);
2352 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2353 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2354 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2355 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2356 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2357 void abs() throw(INTERP_KERNEL::Exception);
2358 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2359 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2360 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2361 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2362 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2363 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2364 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2365 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2366 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2367 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2368 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2369 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2370 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2371 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2372 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2373 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2374 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2375 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2376 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2377 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2378 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2379 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2380 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2381 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2382 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2383 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2384 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2385 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2386 void computeOffsets() throw(INTERP_KERNEL::Exception);
2387 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2388 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2389 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2390 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2391 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2392 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2393 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2394 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2395 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2396 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2397 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2398 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2399 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2400 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2401 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2402 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2403 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2404 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2405 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2406 MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
2407 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2408 MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
2409 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2410 MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
2411 MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
2412 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
2413 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
2415 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2418 DataArrayInt() throw(INTERP_KERNEL::Exception)
2420 return DataArrayInt::New();
2423 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2425 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)";
2426 std::string msg(msgBase);
2428 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2431 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2435 if(PyInt_Check(nbOfTuples))
2437 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2439 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2442 if(PyInt_Check(nbOfComp))
2443 {//DataArrayInt.New([1,3,4,5],2,2)
2444 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2446 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2447 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2448 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2449 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2453 throw INTERP_KERNEL::Exception(msg.c_str());
2456 {//DataArrayInt.New([1,3,4],3)
2457 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2459 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2460 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2465 throw INTERP_KERNEL::Exception(msg.c_str());
2468 {// DataArrayInt.New([1,3,4])
2469 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2470 int tmpp1=-1,tmpp2=-1;
2471 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2472 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2476 else if(PyInt_Check(elt0))
2478 int nbOfTuples1=PyInt_AS_LONG(elt0);
2480 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2485 if(PyInt_Check(nbOfTuples))
2486 {//DataArrayInt.New(5,2)
2487 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2489 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2490 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2491 ret->alloc(nbOfTuples1,nbOfCompo);
2495 throw INTERP_KERNEL::Exception(msg.c_str());
2498 throw INTERP_KERNEL::Exception(msg.c_str());
2501 {//DataArrayInt.New(5)
2502 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2503 ret->alloc(nbOfTuples1,1);
2508 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2509 {//DataArrayInt.New(numpyArray)
2510 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2514 throw INTERP_KERNEL::Exception(msg.c_str());
2515 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2518 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2520 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2523 std::string __str__() const throw(INTERP_KERNEL::Exception)
2525 return self->reprNotTooLong();
2528 int __len__() const throw(INTERP_KERNEL::Exception)
2530 if(self->isAllocated())
2532 return self->getNumberOfTuples();
2536 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2540 int __int__() const throw(INTERP_KERNEL::Exception)
2542 return self->intValue();
2545 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2547 return self->iterator();
2550 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2552 int sz=self->getNumberOfComponents();
2553 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2554 self->accumulate(tmp);
2555 return convertIntArrToPyList(tmp,sz);
2558 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2561 std::vector<int> val2;
2562 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2563 return self->accumulatePerChunck(bg,bg+sz);
2566 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2569 std::vector<int> val2;
2570 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2571 return self->findIdsEqualTuple(bg,bg+sz);
2574 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2576 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2577 PyObject *ret=PyList_New(slcs.size());
2578 for(std::size_t i=0;i<slcs.size();i++)
2579 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2583 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2585 if(!PySlice_Check(slic))
2586 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2587 Py_ssize_t strt=2,stp=2,step=2;
2588 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2589 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2590 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2591 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 !");
2592 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2595 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2598 self->getMinMaxValues(a,b);
2599 PyObject *ret=PyTuple_New(2);
2600 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2601 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2605 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2607 int newNbOfTuples=-1;
2608 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2609 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2610 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2611 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2612 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2613 PyObject *ret=PyTuple_New(2);
2614 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2615 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2619 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2621 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2622 int szArr,sw,iTypppArr;
2623 std::vector<int> stdvecTyyppArr;
2624 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2625 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2626 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2630 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2632 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 !";
2633 if(PyList_Check(li) || PyTuple_Check(li))
2635 if(nbOfTuples && nbOfTuples != Py_None)
2637 if(PyInt_Check(nbOfTuples))
2639 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2641 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2642 if(nbOfComp && nbOfComp != Py_None)
2644 if(PyInt_Check(nbOfComp))
2645 {//DataArrayInt.setValues([1,3,4,5],2,2)
2646 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2648 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2649 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2650 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2653 throw INTERP_KERNEL::Exception(msg);
2656 {//DataArrayInt.setValues([1,3,4],3)
2658 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2659 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2663 throw INTERP_KERNEL::Exception(msg);
2666 {// DataArrayInt.setValues([1,3,4])
2667 int tmpp1=-1,tmpp2=-1;
2668 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2669 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2673 throw INTERP_KERNEL::Exception(msg);
2676 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2678 const int *vals=self->getConstPointer();
2679 return convertIntArrToPyList(vals,self->getNbOfElems());
2683 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2685 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2689 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2692 bool ret0=self->isEqualIfNotWhy(other,ret1);
2693 PyObject *ret=PyTuple_New(2);
2694 PyObject *ret0Py=ret0?Py_True:Py_False;
2696 PyTuple_SetItem(ret,0,ret0Py);
2697 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2701 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2703 const int *vals=self->getConstPointer();
2704 int nbOfComp=self->getNumberOfComponents();
2705 int nbOfTuples=self->getNumberOfTuples();
2706 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2709 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2711 std::vector<const DataArrayInt *> groups;
2712 std::vector< std::vector<int> > fidsOfGroups;
2713 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2714 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2715 PyObject *ret = PyList_New(2);
2716 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2717 int sz=fidsOfGroups.size();
2718 PyObject *ret1 = PyList_New(sz);
2719 for(int i=0;i<sz;i++)
2720 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2721 PyList_SetItem(ret,1,ret1);
2725 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2728 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2729 if (!SWIG_IsOK(res1))
2732 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2733 self->transformWithIndArr(tmp,tmp+size);
2737 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2738 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2742 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2746 std::vector<int> multiVal;
2747 std::pair<int, std::pair<int,int> > slic;
2748 MEDCoupling::DataArrayInt *daIntTyypp=0;
2749 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2753 return self->findIdsEqualList(&singleVal,&singleVal+1);
2755 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2757 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2759 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2763 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2767 std::vector<int> multiVal;
2768 std::pair<int, std::pair<int,int> > slic;
2769 MEDCoupling::DataArrayInt *daIntTyypp=0;
2770 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2774 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2776 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2778 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2780 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2784 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2786 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2788 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2789 if (!SWIG_IsOK(res1))
2792 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2793 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2797 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2799 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2800 da2->checkAllocated();
2801 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2803 PyObject *ret = PyList_New(3);
2804 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2805 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2806 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2810 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2813 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2814 if (!SWIG_IsOK(res1))
2817 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2818 return self->transformWithIndArrR(tmp,tmp+size);
2822 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2823 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2827 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2830 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2831 if (!SWIG_IsOK(res1))
2834 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2835 if(size!=self->getNumberOfTuples())
2837 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2839 return self->renumberAndReduce(tmp,newNbOfTuple);
2843 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2845 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2846 da2->checkAllocated();
2847 int size=self->getNumberOfTuples();
2848 if(size!=self->getNumberOfTuples())
2850 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2852 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2856 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2859 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2860 if (!SWIG_IsOK(res1))
2863 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2864 if(size!=self->getNumberOfTuples())
2866 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2868 return self->renumber(tmp);
2872 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2874 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2875 da2->checkAllocated();
2876 int size=self->getNumberOfTuples();
2877 if(size!=self->getNumberOfTuples())
2879 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2881 return self->renumber(da2->getConstPointer());
2885 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2888 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2889 if (!SWIG_IsOK(res1))
2892 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2893 if(size!=self->getNumberOfTuples())
2895 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2897 return self->renumberR(tmp);
2901 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2903 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2904 da2->checkAllocated();
2905 int size=self->getNumberOfTuples();
2906 if(size!=self->getNumberOfTuples())
2908 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2910 return self->renumberR(da2->getConstPointer());
2914 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2916 std::vector<int> tmp;
2917 convertPyToNewIntArr3(li,tmp);
2918 self->setSelectedComponents(a,tmp);
2921 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2923 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2924 std::size_t sz(retCpp.size());
2925 PyObject *res(PyList_New(sz));
2926 for(std::size_t i=0;i<sz;i++)
2927 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2931 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2933 int sz=self->getNumberOfComponents();
2934 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2935 self->getTuple(tupleId,tmp);
2936 return convertIntArrToPyList(tmp,sz);
2939 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2941 DataArrayInt *arr=0;
2942 DataArrayInt *arrI=0;
2943 self->changeSurjectiveFormat(targetNb,arr,arrI);
2944 PyObject *res = PyList_New(2);
2945 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2946 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2950 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2952 std::vector<const DataArrayInt *> tmp;
2953 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2954 return DataArrayInt::Meld(tmp);
2957 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2959 std::vector<const DataArrayInt *> tmp;
2960 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2961 return DataArrayInt::Aggregate(tmp);
2964 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2966 std::vector<const DataArrayInt *> tmp;
2967 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2968 return DataArrayInt::AggregateIndexes(tmp);
2971 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2973 std::vector<const DataArrayInt *> tmp;
2974 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2975 return DataArrayInt::BuildUnion(tmp);
2978 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2980 std::vector<const DataArrayInt *> tmp;
2981 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2982 return DataArrayInt::BuildIntersection(tmp);
2985 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2988 int r1=self->getMaxValue(tmp);
2989 PyObject *ret=PyTuple_New(2);
2990 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2991 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2995 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2998 int r1=self->getMinValue(tmp);
2999 PyObject *ret=PyTuple_New(2);
3000 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3001 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3005 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3007 int nbOfCompo=self->getNumberOfComponents();
3012 if(PyInt_Check(obj))
3014 int val=(int)PyInt_AS_LONG(obj);
3015 return self->findIdFirstEqual(val);
3018 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3022 std::vector<int> arr;
3023 convertPyToNewIntArr3(obj,arr);
3024 return self->findIdFirstEqualTuple(arr);
3029 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3031 int nbOfCompo=self->getNumberOfComponents();
3038 if(PyInt_Check(obj))
3040 int val=(int)PyInt_AS_LONG(obj);
3041 return self->presenceOfValue(val);
3044 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3048 std::vector<int> arr;
3049 convertPyToNewIntArr3(obj,arr);
3050 return self->presenceOfTuple(arr);
3055 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3057 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3058 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3059 self->checkAllocated();
3060 int nbOfTuples=self->getNumberOfTuples();
3061 int nbOfComponents=self->getNumberOfComponents();
3063 std::vector<int> vt1,vc1;
3064 std::pair<int, std::pair<int,int> > pt1,pc1;
3065 DataArrayInt *dt1=0,*dc1=0;
3067 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3068 MCAuto<DataArrayInt> ret;
3073 if(nbOfComponents==1)
3074 return PyInt_FromLong(self->getIJSafe(it1,0));
3075 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3078 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3080 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3082 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3084 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3087 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3088 std::vector<int> v2(1,ic1);
3089 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3093 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3094 std::vector<int> v2(1,ic1);
3095 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3099 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3100 std::vector<int> v2(1,ic1);
3101 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3105 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3106 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3110 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3111 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3115 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3116 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3120 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3121 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3125 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3126 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3127 std::vector<int> v2(nbOfComp);
3128 for(int i=0;i<nbOfComp;i++)
3129 v2[i]=pc1.first+i*pc1.second.second;
3130 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3134 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3135 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3136 std::vector<int> v2(nbOfComp);
3137 for(int i=0;i<nbOfComp;i++)
3138 v2[i]=pc1.first+i*pc1.second.second;
3139 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3143 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3144 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3145 std::vector<int> v2(nbOfComp);
3146 for(int i=0;i<nbOfComp;i++)
3147 v2[i]=pc1.first+i*pc1.second.second;
3148 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3152 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3153 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3154 std::vector<int> v2(nbOfComp);
3155 for(int i=0;i<nbOfComp;i++)
3156 v2[i]=pc1.first+i*pc1.second.second;
3157 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3160 throw INTERP_KERNEL::Exception(msg);
3164 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3166 self->checkAllocated();
3167 const char msg[]="Unexpected situation in __setitem__ !";
3168 int nbOfTuples=self->getNumberOfTuples();
3169 int nbOfComponents=self->getNumberOfComponents();
3172 std::vector<int> v1;
3174 DataArrayIntTuple *dd1=0;
3175 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3177 std::vector<int> vt1,vc1;
3178 std::pair<int, std::pair<int,int> > pt1,pc1;
3179 DataArrayInt *dt1=0,*dc1=0;
3180 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3181 MCAuto<DataArrayInt> tmp;
3189 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3192 tmp=DataArrayInt::New();
3193 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3194 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3197 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3200 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3201 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3204 throw INTERP_KERNEL::Exception(msg);
3213 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3216 tmp=DataArrayInt::New();
3217 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3218 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3221 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3224 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3225 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3228 throw INTERP_KERNEL::Exception(msg);
3237 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3240 tmp=DataArrayInt::New();
3241 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3242 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3245 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3248 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3249 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3252 throw INTERP_KERNEL::Exception(msg);
3261 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3264 tmp=DataArrayInt::New();
3265 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3266 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3269 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3272 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3273 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3276 throw INTERP_KERNEL::Exception(msg);
3285 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3288 tmp=DataArrayInt::New();
3289 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3290 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3293 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3296 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3297 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3300 throw INTERP_KERNEL::Exception(msg);
3309 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3312 tmp=DataArrayInt::New();
3313 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3314 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3317 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3320 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3321 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3324 throw INTERP_KERNEL::Exception(msg);
3333 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3336 tmp=DataArrayInt::New();
3337 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3338 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3341 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3344 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3345 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3348 throw INTERP_KERNEL::Exception(msg);
3357 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3360 tmp=DataArrayInt::New();
3361 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3362 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3365 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3368 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3369 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3372 throw INTERP_KERNEL::Exception(msg);
3381 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3384 tmp=DataArrayInt::New();
3385 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3386 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3389 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3392 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3393 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3396 throw INTERP_KERNEL::Exception(msg);
3405 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3408 tmp=DataArrayInt::New();
3409 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3410 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3413 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3416 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3417 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3420 throw INTERP_KERNEL::Exception(msg);
3429 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3432 tmp=DataArrayInt::New();
3433 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3434 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3437 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3440 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3441 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3444 throw INTERP_KERNEL::Exception(msg);
3453 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3456 tmp=DataArrayInt::New();
3457 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3458 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3461 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3464 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3465 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3468 throw INTERP_KERNEL::Exception(msg);
3477 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3480 tmp=DataArrayInt::New();
3481 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3482 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3485 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3488 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3489 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3492 throw INTERP_KERNEL::Exception(msg);
3501 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3504 tmp=DataArrayInt::New();
3505 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3506 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3509 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3512 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3513 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3516 throw INTERP_KERNEL::Exception(msg);
3525 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3528 tmp=DataArrayInt::New();
3529 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3530 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3533 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3536 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3537 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3540 throw INTERP_KERNEL::Exception(msg);
3549 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3552 tmp=DataArrayInt::New();
3553 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3554 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3557 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3560 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3561 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3564 throw INTERP_KERNEL::Exception(msg);
3569 throw INTERP_KERNEL::Exception(msg);
3574 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3576 return self->negate();
3579 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3581 const char msg[]="Unexpected situation in __add__ !";
3584 std::vector<int> aa;
3585 DataArrayIntTuple *aaa;
3587 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3592 MCAuto<DataArrayInt> ret=self->deepCopy();
3593 ret->applyLin(1,val);
3598 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3599 return DataArrayInt::Add(self,aaaa);
3603 return DataArrayInt::Add(self,a);
3607 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3608 return DataArrayInt::Add(self,aaaa);
3611 throw INTERP_KERNEL::Exception(msg);
3615 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3617 const char msg[]="Unexpected situation in __radd__ !";
3620 std::vector<int> aa;
3621 DataArrayIntTuple *aaa;
3623 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3628 MCAuto<DataArrayInt> ret=self->deepCopy();
3629 ret->applyLin(1,val);
3634 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3635 return DataArrayInt::Add(self,aaaa);
3639 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3640 return DataArrayInt::Add(self,aaaa);
3643 throw INTERP_KERNEL::Exception(msg);
3647 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3649 const char msg[]="Unexpected situation in __iadd__ !";
3652 std::vector<int> aa;
3653 DataArrayIntTuple *aaa;
3655 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3660 self->applyLin(1,val);
3661 Py_XINCREF(trueSelf);
3666 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3668 Py_XINCREF(trueSelf);
3674 Py_XINCREF(trueSelf);
3679 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3680 self->addEqual(aaaa);
3681 Py_XINCREF(trueSelf);
3685 throw INTERP_KERNEL::Exception(msg);
3689 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3691 const char msg[]="Unexpected situation in __sub__ !";
3694 std::vector<int> aa;
3695 DataArrayIntTuple *aaa;
3697 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3702 MCAuto<DataArrayInt> ret=self->deepCopy();
3703 ret->applyLin(1,-val);
3708 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3709 return DataArrayInt::Substract(self,aaaa);
3713 return DataArrayInt::Substract(self,a);
3717 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3718 return DataArrayInt::Substract(self,aaaa);
3721 throw INTERP_KERNEL::Exception(msg);
3725 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3727 const char msg[]="Unexpected situation in __rsub__ !";
3730 std::vector<int> aa;
3731 DataArrayIntTuple *aaa;
3733 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3738 MCAuto<DataArrayInt> ret=self->deepCopy();
3739 ret->applyLin(-1,val);
3744 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3745 return DataArrayInt::Substract(aaaa,self);
3749 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3750 return DataArrayInt::Substract(aaaa,self);
3753 throw INTERP_KERNEL::Exception(msg);
3757 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3759 const char msg[]="Unexpected situation in __isub__ !";
3762 std::vector<int> aa;
3763 DataArrayIntTuple *aaa;
3765 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3770 self->applyLin(1,-val);
3771 Py_XINCREF(trueSelf);
3776 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3777 self->substractEqual(bb);
3778 Py_XINCREF(trueSelf);
3783 self->substractEqual(a);
3784 Py_XINCREF(trueSelf);
3789 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3790 self->substractEqual(aaaa);
3791 Py_XINCREF(trueSelf);
3795 throw INTERP_KERNEL::Exception(msg);
3799 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3801 const char msg[]="Unexpected situation in __mul__ !";
3804 std::vector<int> aa;
3805 DataArrayIntTuple *aaa;
3807 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3812 MCAuto<DataArrayInt> ret=self->deepCopy();
3813 ret->applyLin(val,0);
3818 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3819 return DataArrayInt::Multiply(self,aaaa);
3823 return DataArrayInt::Multiply(self,a);
3827 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3828 return DataArrayInt::Multiply(self,aaaa);
3831 throw INTERP_KERNEL::Exception(msg);
3835 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3837 const char msg[]="Unexpected situation in __rmul__ !";
3840 std::vector<int> aa;
3841 DataArrayIntTuple *aaa;
3843 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3848 MCAuto<DataArrayInt> ret=self->deepCopy();
3849 ret->applyLin(val,0);
3854 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3855 return DataArrayInt::Multiply(self,aaaa);
3859 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3860 return DataArrayInt::Multiply(self,aaaa);
3863 throw INTERP_KERNEL::Exception(msg);
3867 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3869 const char msg[]="Unexpected situation in __imul__ !";
3872 std::vector<int> aa;
3873 DataArrayIntTuple *aaa;
3875 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3880 self->applyLin(val,0);
3881 Py_XINCREF(trueSelf);
3886 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3887 self->multiplyEqual(bb);
3888 Py_XINCREF(trueSelf);
3893 self->multiplyEqual(a);
3894 Py_XINCREF(trueSelf);
3899 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3900 self->multiplyEqual(aaaa);
3901 Py_XINCREF(trueSelf);
3905 throw INTERP_KERNEL::Exception(msg);
3909 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3911 const char msg[]="Unexpected situation in __div__ !";
3914 std::vector<int> aa;
3915 DataArrayIntTuple *aaa;
3917 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3922 MCAuto<DataArrayInt> ret=self->deepCopy();
3923 ret->applyDivideBy(val);
3928 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3929 return DataArrayInt::Divide(self,aaaa);
3933 return DataArrayInt::Divide(self,a);
3937 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3938 return DataArrayInt::Divide(self,aaaa);
3941 throw INTERP_KERNEL::Exception(msg);
3945 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3947 const char msg[]="Unexpected situation in __rdiv__ !";
3950 std::vector<int> aa;
3951 DataArrayIntTuple *aaa;
3953 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3958 MCAuto<DataArrayInt> ret=self->deepCopy();
3964 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3965 return DataArrayInt::Divide(aaaa,self);
3969 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3970 return DataArrayInt::Divide(aaaa,self);
3973 throw INTERP_KERNEL::Exception(msg);
3977 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3979 const char msg[]="Unexpected situation in __idiv__ !";
3982 std::vector<int> aa;
3983 DataArrayIntTuple *aaa;
3985 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3990 self->applyDivideBy(val);
3991 Py_XINCREF(trueSelf);
3996 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3997 self->divideEqual(bb);
3998 Py_XINCREF(trueSelf);
4003 self->divideEqual(a);
4004 Py_XINCREF(trueSelf);
4009 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4010 self->divideEqual(aaaa);
4011 Py_XINCREF(trueSelf);
4015 throw INTERP_KERNEL::Exception(msg);
4019 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4021 const char msg[]="Unexpected situation in __mod__ !";
4024 std::vector<int> aa;
4025 DataArrayIntTuple *aaa;
4027 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4032 MCAuto<DataArrayInt> ret=self->deepCopy();
4033 ret->applyModulus(val);
4038 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4039 return DataArrayInt::Modulus(self,aaaa);
4043 return DataArrayInt::Modulus(self,a);
4047 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4048 return DataArrayInt::Modulus(self,aaaa);
4051 throw INTERP_KERNEL::Exception(msg);
4055 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4057 const char msg[]="Unexpected situation in __rmod__ !";
4060 std::vector<int> aa;
4061 DataArrayIntTuple *aaa;
4063 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4068 MCAuto<DataArrayInt> ret=self->deepCopy();
4069 ret->applyRModulus(val);
4074 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4075 return DataArrayInt::Modulus(aaaa,self);
4079 return DataArrayInt::Modulus(a,self);
4083 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4084 return DataArrayInt::Modulus(aaaa,self);
4087 throw INTERP_KERNEL::Exception(msg);
4091 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4093 const char msg[]="Unexpected situation in __imod__ !";
4096 std::vector<int> aa;
4097 DataArrayIntTuple *aaa;
4099 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4104 self->applyModulus(val);
4105 Py_XINCREF(trueSelf);
4110 self->modulusEqual(a);
4111 Py_XINCREF(trueSelf);
4116 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4117 self->modulusEqual(aaaa);
4118 Py_XINCREF(trueSelf);
4122 throw INTERP_KERNEL::Exception(msg);
4126 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4128 const char msg[]="Unexpected situation in __pow__ !";
4131 std::vector<int> aa;
4132 DataArrayIntTuple *aaa;
4134 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4139 MCAuto<DataArrayInt> ret=self->deepCopy();
4145 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4146 return DataArrayInt::Pow(self,aaaa);
4150 return DataArrayInt::Pow(self,a);
4154 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4155 return DataArrayInt::Pow(self,aaaa);
4158 throw INTERP_KERNEL::Exception(msg);
4162 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4164 const char msg[]="Unexpected situation in __rpow__ !";
4167 std::vector<int> aa;
4168 DataArrayIntTuple *aaa;
4170 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4175 MCAuto<DataArrayInt> ret=self->deepCopy();
4176 ret->applyRPow(val);
4181 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4182 return DataArrayInt::Pow(aaaa,self);
4186 return DataArrayInt::Pow(a,self);
4190 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4191 return DataArrayInt::Pow(aaaa,self);
4194 throw INTERP_KERNEL::Exception(msg);
4198 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4200 const char msg[]="Unexpected situation in __ipow__ !";
4203 std::vector<int> aa;
4204 DataArrayIntTuple *aaa;
4206 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4211 self->applyPow(val);
4212 Py_XINCREF(trueSelf);
4218 Py_XINCREF(trueSelf);
4223 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4224 self->powEqual(aaaa);
4225 Py_XINCREF(trueSelf);
4229 throw INTERP_KERNEL::Exception(msg);
4233 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4235 std::ostringstream oss;
4236 self->reprQuickOverview(oss);
4240 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4242 int szArr,sw,iTypppArr;
4243 std::vector<int> stdvecTyyppArr;
4244 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4245 self->pushBackValsSilent(tmp,tmp+szArr);
4248 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4250 std::vector<int> ret1;
4251 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4252 std::size_t sz=ret0.size();
4253 PyObject *pyRet=PyTuple_New(2);
4254 PyObject *pyRet0=PyList_New((int)sz);
4255 PyObject *pyRet1=PyList_New((int)sz);
4256 for(std::size_t i=0;i<sz;i++)
4258 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4259 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4261 PyTuple_SetItem(pyRet,0,pyRet0);
4262 PyTuple_SetItem(pyRet,1,pyRet1);
4266 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4268 DataArrayInt *ret0=0,*ret1=0;
4269 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4270 PyObject *pyRet=PyTuple_New(2);
4271 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4272 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4276 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4279 bool ret(self->isRange(a,b,c));
4280 PyObject *pyRet=PyTuple_New(2);
4281 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4283 PyTuple_SetItem(pyRet,0,ret0Py);
4285 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4291 PyTuple_SetItem(pyRet,1,ret1Py);
4296 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4298 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4301 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4304 if(!self->isAllocated())
4305 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4306 PyObject *ret(PyTuple_New(1));
4307 PyObject *ret0(PyDict_New());
4308 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4309 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4310 PyObject *tmp1(PyInt_FromLong(0));
4311 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4312 PyTuple_SetItem(ret,0,ret0);
4316 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4322 class DataArrayIntTuple;
4324 class DataArrayIntIterator
4327 DataArrayIntIterator(DataArrayInt *da);
4328 ~DataArrayIntIterator();
4333 DataArrayIntTuple *ret=self->nextt();
4335 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4338 PyErr_SetString(PyExc_StopIteration,"No more data.");
4345 class DataArrayIntTuple
4348 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4349 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4352 std::string __str__() const throw(INTERP_KERNEL::Exception)
4354 return self->repr();
4357 int __int__() const throw(INTERP_KERNEL::Exception)
4359 return self->intValue();
4362 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4364 return self->buildDAInt(1,self->getNumberOfCompo());
4367 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4369 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4370 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4371 Py_XINCREF(trueSelf);
4375 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4377 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4378 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4379 Py_XINCREF(trueSelf);
4383 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4385 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4386 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4387 Py_XINCREF(trueSelf);
4391 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4393 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4394 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4395 Py_XINCREF(trueSelf);
4399 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4401 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4402 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4403 Py_XINCREF(trueSelf);
4407 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4409 return PyInt_FromLong(self->getNumberOfCompo());
4412 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4414 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4417 std::vector<int> multiVal;
4418 std::pair<int, std::pair<int,int> > slic;
4419 MEDCoupling::DataArrayInt *daIntTyypp=0;
4420 const int *pt=self->getConstPointer();
4421 int nbc=self->getNumberOfCompo();
4422 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4429 std::ostringstream oss;
4430 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4431 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4435 return PyInt_FromLong(pt[singleVal]);
4439 return PyInt_FromLong(pt[nbc+singleVal]);
4442 std::ostringstream oss;
4443 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4444 throw INTERP_KERNEL::Exception(oss.str().c_str());
4450 PyObject *t=PyTuple_New(multiVal.size());
4451 for(int j=0;j<(int)multiVal.size();j++)
4453 int cid=multiVal[j];
4456 std::ostringstream oss;
4457 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4458 throw INTERP_KERNEL::Exception(oss.str().c_str());
4460 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4466 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4467 PyObject *t=PyTuple_New(sz);
4468 for(int j=0;j<sz;j++)
4469 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4473 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4477 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4479 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4480 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4483 std::vector<int> multiValV;
4484 std::pair<int, std::pair<int,int> > slicV;
4485 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4486 int nbc=self->getNumberOfCompo();
4487 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4489 std::vector<int> multiVal;
4490 std::pair<int, std::pair<int,int> > slic;
4491 MEDCoupling::DataArrayInt *daIntTyypp=0;
4492 int *pt=self->getPointer();
4493 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4500 std::ostringstream oss;
4501 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4502 throw INTERP_KERNEL::Exception(oss.str().c_str());
4508 pt[singleVal]=singleValV;
4513 if(multiValV.size()!=1)
4515 std::ostringstream oss;
4516 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4517 throw INTERP_KERNEL::Exception(oss.str().c_str());
4519 pt[singleVal]=multiValV[0];
4524 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4528 throw INTERP_KERNEL::Exception(msg);
4537 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4541 std::ostringstream oss;
4542 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4543 throw INTERP_KERNEL::Exception(oss.str().c_str());
4551 if(multiVal.size()!=multiValV.size())
4553 std::ostringstream oss;
4554 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4555 throw INTERP_KERNEL::Exception(oss.str().c_str());
4557 for(int i=0;i<(int)multiVal.size();i++)
4559 int pos=multiVal[i];
4562 std::ostringstream oss;
4563 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4564 throw INTERP_KERNEL::Exception(oss.str().c_str());
4566 pt[multiVal[i]]=multiValV[i];
4572 const int *ptV=daIntTyyppV->getConstPointer();
4573 if(nbc>daIntTyyppV->getNumberOfCompo())
4575 std::ostringstream oss;
4576 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4577 throw INTERP_KERNEL::Exception(oss.str().c_str());
4579 std::copy(ptV,ptV+nbc,pt);
4583 throw INTERP_KERNEL::Exception(msg);
4588 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4593 for(int j=0;j<sz;j++)
4594 pt[slic.first+j*slic.second.second]=singleValV;
4599 if(sz!=(int)multiValV.size())
4601 std::ostringstream oss;
4602 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4603 throw INTERP_KERNEL::Exception(oss.str().c_str());
4605 for(int j=0;j<sz;j++)
4606 pt[slic.first+j*slic.second.second]=multiValV[j];
4611 const int *ptV=daIntTyyppV->getConstPointer();
4612 if(sz>daIntTyyppV->getNumberOfCompo())
4614 std::ostringstream oss;
4615 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4616 throw INTERP_KERNEL::Exception(oss.str().c_str());
4618 for(int j=0;j<sz;j++)
4619 pt[slic.first+j*slic.second.second]=ptV[j];
4623 throw INTERP_KERNEL::Exception(msg);
4627 throw INTERP_KERNEL::Exception(msg);
4633 class DataArrayChar : public DataArray
4636 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4637 int getHashCode() const throw(INTERP_KERNEL::Exception);
4638 bool empty() const throw(INTERP_KERNEL::Exception);
4639 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4640 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4641 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4642 char popBackSilent() throw(INTERP_KERNEL::Exception);
4643 void pack() const throw(INTERP_KERNEL::Exception);
4644 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4645 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4646 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4647 void reverse() throw(INTERP_KERNEL::Exception);
4648 void fillWithZero() throw(INTERP_KERNEL::Exception);
4649 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4650 std::string repr() const throw(INTERP_KERNEL::Exception);
4651 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4652 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4653 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4654 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4655 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4656 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4657 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4658 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4659 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4660 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4661 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4662 char front() const throw(INTERP_KERNEL::Exception);
4663 char back() const throw(INTERP_KERNEL::Exception);
4664 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4665 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4666 char *getPointer() throw(INTERP_KERNEL::Exception);
4667 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4668 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4669 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4670 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4671 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4672 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4673 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4674 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4675 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4676 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4677 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4680 int __len__() const throw(INTERP_KERNEL::Exception)
4682 if(self->isAllocated())
4684 return self->getNumberOfTuples();
4688 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4692 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4695 bool ret0=self->isEqualIfNotWhy(other,ret1);
4696 PyObject *ret=PyTuple_New(2);
4697 PyObject *ret0Py=ret0?Py_True:Py_False;
4699 PyTuple_SetItem(ret,0,ret0Py);
4700 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4704 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4707 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4708 if (!SWIG_IsOK(res1))
4711 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4712 if(size!=self->getNumberOfTuples())
4714 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4716 return self->renumber(tmp);
4720 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4722 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4723 da2->checkAllocated();
4724 int size=self->getNumberOfTuples();
4725 if(size!=self->getNumberOfTuples())
4727 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4729 return self->renumber(da2->getConstPointer());
4733 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4736 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4737 if (!SWIG_IsOK(res1))
4740 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4741 if(size!=self->getNumberOfTuples())
4743 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4745 return self->renumberR(tmp);
4749 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4751 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4752 da2->checkAllocated();
4753 int size=self->getNumberOfTuples();
4754 if(size!=self->getNumberOfTuples())
4756 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4758 return self->renumberR(da2->getConstPointer());
4762 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4765 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4766 if (!SWIG_IsOK(res1))
4769 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4770 if(size!=self->getNumberOfTuples())
4772 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4774 return self->renumberAndReduce(tmp,newNbOfTuple);
4778 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4780 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4781 da2->checkAllocated();
4782 int size=self->getNumberOfTuples();
4783 if(size!=self->getNumberOfTuples())
4785 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4787 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4791 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4793 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4794 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4795 return DataArrayChar::Aggregate(tmp);
4798 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4800 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4801 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4802 return DataArrayChar::Meld(tmp);
4807 class DataArrayByteIterator;
4809 class DataArrayByte : public DataArrayChar
4812 static DataArrayByte *New();
4813 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4814 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4815 char byteValue() const throw(INTERP_KERNEL::Exception);
4818 DataArrayByte() throw(INTERP_KERNEL::Exception)
4820 return DataArrayByte::New();
4823 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4825 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) !";
4826 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4830 if(PyInt_Check(nbOfTuples))
4832 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4834 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4837 if(PyInt_Check(nbOfComp))
4838 {//DataArrayByte.New([1,3,4,5],2,2)
4839 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4841 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4842 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4843 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4844 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4848 throw INTERP_KERNEL::Exception(msg);
4851 {//DataArrayByte.New([1,3,4],3)
4852 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4854 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4855 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4860 throw INTERP_KERNEL::Exception(msg);
4863 {// DataArrayByte.New([1,3,4])
4864 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4865 int tmpp1=-1,tmpp2=-1;
4866 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4867 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4871 else if(PyInt_Check(elt0))
4873 int nbOfTuples1=PyInt_AS_LONG(elt0);
4875 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4880 if(PyInt_Check(nbOfTuples))
4881 {//DataArrayByte.New(5,2)
4882 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4884 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4885 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4886 ret->alloc(nbOfTuples1,nbOfCompo);
4890 throw INTERP_KERNEL::Exception(msg);
4893 throw INTERP_KERNEL::Exception(msg);
4896 {//DataArrayByte.New(5)
4897 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4898 ret->alloc(nbOfTuples1,1);
4903 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4904 {//DataArrayDouble.New(numpyArray)
4905 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4909 throw INTERP_KERNEL::Exception(msg);
4912 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4914 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4917 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4919 std::ostringstream oss;
4920 self->reprQuickOverview(oss);
4924 int __int__() const throw(INTERP_KERNEL::Exception)
4926 return (int) self->byteValue();
4929 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4931 return self->iterator();
4934 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4936 return (int)self->getIJ(tupleId,compoId);
4939 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4941 return (int)self->getIJSafe(tupleId,compoId);
4944 std::string __str__() const throw(INTERP_KERNEL::Exception)
4946 return self->repr();
4949 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4951 const char *vals=self->getConstPointer();
4952 int nbOfComp=self->getNumberOfComponents();
4953 int nbOfTuples=self->getNumberOfTuples();
4954 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4957 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4960 int ival=-1; std::vector<int> ivval;
4961 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4962 std::vector<char> vals(sz);
4963 std::copy(pt,pt+sz,vals.begin());
4964 return self->presenceOfTuple(vals);
4967 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4970 int ival=-1; std::vector<int> ivval;
4971 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4972 std::vector<char> vals2(sz);
4973 std::copy(pt,pt+sz,vals2.begin());
4974 return self->presenceOfValue(vals2);
4977 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4980 int ival=-1; std::vector<int> ivval;
4981 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4982 std::vector<char> vals2(sz);
4983 std::copy(pt,pt+sz,vals2.begin());
4984 return self->findIdFirstEqual(vals2);
4987 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4990 int ival=-1; std::vector<int> ivval;
4991 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4992 std::vector<char> vals(sz);
4993 std::copy(pt,pt+sz,vals.begin());
4994 return self->findIdFirstEqualTuple(vals);
4997 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5000 int ival=-1; std::vector<int> ivval;
5001 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
5002 std::vector<char> vals(sz);
5003 std::copy(pt,pt+sz,vals.begin());
5004 return self->findIdSequence(vals);
5007 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5009 int sz=self->getNumberOfComponents();
5010 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5011 self->getTuple(tupleId,tmp);
5012 PyObject *ret=PyTuple_New(sz);
5013 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5017 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5020 int r1=(int)self->getMaxValue(tmp);
5021 PyObject *ret=PyTuple_New(2);
5022 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5023 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5027 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5030 int r1=(int)self->getMinValue(tmp);
5031 PyObject *ret=PyTuple_New(2);
5032 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5033 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5037 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5039 int nbOfCompo=self->getNumberOfComponents();
5044 if(PyInt_Check(obj))
5046 int val=(int)PyInt_AS_LONG(obj);
5047 return self->findIdFirstEqual(val);
5050 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5053 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5057 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5059 int nbOfCompo=self->getNumberOfComponents();
5066 if(PyInt_Check(obj))
5068 int val=(int)PyInt_AS_LONG(obj);
5069 return self->presenceOfValue(val);
5072 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5075 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5080 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5082 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5087 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5089 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5092 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5095 if(!self->isAllocated())
5096 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5097 PyObject *ret(PyTuple_New(1));
5098 PyObject *ret0(PyDict_New());
5099 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5100 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5101 PyObject *tmp1(PyInt_FromLong(0));
5102 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5103 PyTuple_SetItem(ret,0,ret0);
5107 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5111 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5113 self->checkAllocated();
5114 const char msg[]="Unexpected situation in __setitem__ !";
5115 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5118 std::vector<int> v1;
5120 DataArrayIntTuple *dd1=0;
5121 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5123 std::vector<int> vt1,vc1;
5124 std::pair<int, std::pair<int,int> > pt1,pc1;
5125 DataArrayInt *dt1=0,*dc1=0;
5126 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5127 MCAuto<DataArrayInt> tmp;
5135 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5138 throw INTERP_KERNEL::Exception(msg);
5147 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5150 throw INTERP_KERNEL::Exception(msg);
5159 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5162 throw INTERP_KERNEL::Exception(msg);
5171 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5174 throw INTERP_KERNEL::Exception(msg);
5183 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5186 throw INTERP_KERNEL::Exception(msg);
5195 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5198 throw INTERP_KERNEL::Exception(msg);
5207 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5210 throw INTERP_KERNEL::Exception(msg);
5219 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5222 throw INTERP_KERNEL::Exception(msg);
5231 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5234 throw INTERP_KERNEL::Exception(msg);
5243 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5246 throw INTERP_KERNEL::Exception(msg);
5255 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5258 throw INTERP_KERNEL::Exception(msg);
5267 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5270 throw INTERP_KERNEL::Exception(msg);
5279 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5282 throw INTERP_KERNEL::Exception(msg);
5291 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5294 throw INTERP_KERNEL::Exception(msg);
5303 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5306 throw INTERP_KERNEL::Exception(msg);
5315 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5318 throw INTERP_KERNEL::Exception(msg);
5323 throw INTERP_KERNEL::Exception(msg);
5330 class DataArrayByteTuple;
5332 class DataArrayByteIterator
5335 DataArrayByteIterator(DataArrayByte *da);
5336 ~DataArrayByteIterator();
5339 class DataArrayByteTuple
5342 std::string repr() const throw(INTERP_KERNEL::Exception);
5343 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5346 std::string __str__() const throw(INTERP_KERNEL::Exception)
5348 return self->repr();
5351 char __int__() const throw(INTERP_KERNEL::Exception)
5353 return self->byteValue();
5356 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5358 return self->buildDAByte(1,self->getNumberOfCompo());
5363 class DataArrayAsciiCharIterator;
5365 class DataArrayAsciiChar : public DataArrayChar
5368 static DataArrayAsciiChar *New();
5369 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5370 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5371 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5374 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5376 return DataArrayAsciiChar::New();
5379 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5381 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) !";
5382 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5386 if(PyInt_Check(nbOfTuples))
5388 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5390 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5393 if(PyInt_Check(nbOfComp))
5394 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5395 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5397 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5398 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5399 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5400 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5404 throw INTERP_KERNEL::Exception(msg);
5407 {//DataArrayAsciiChar.New([1,3,4],3)
5408 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5410 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5411 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5415 else if(PyString_Check(nbOfTuples))
5417 if(PyString_Size(nbOfTuples)!=1)
5418 throw INTERP_KERNEL::Exception(msg);
5419 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5420 std::vector<std::string> tmp;
5421 if(fillStringVector(elt0,tmp))
5422 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5424 throw INTERP_KERNEL::Exception(msg);
5427 throw INTERP_KERNEL::Exception(msg);
5431 std::vector<std::string> tmmp;
5432 if(fillStringVector(elt0,tmmp))
5433 //DataArrayAsciiChar.New(["abc","de","fghi"])
5434 return DataArrayAsciiChar::New(tmmp,' ');
5437 // DataArrayAsciiChar.New([1,3,4])
5438 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5439 int tmpp1=-1,tmpp2=-1;
5440 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5441 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5446 else if(PyInt_Check(elt0))
5448 int nbOfTuples1=PyInt_AS_LONG(elt0);
5450 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5455 if(PyInt_Check(nbOfTuples))
5456 {//DataArrayAsciiChar.New(5,2)
5457 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5459 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5460 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5461 ret->alloc(nbOfTuples1,nbOfCompo);
5465 throw INTERP_KERNEL::Exception(msg);
5468 throw INTERP_KERNEL::Exception(msg);
5471 {//DataArrayAsciiChar.New(5)
5472 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5473 ret->alloc(nbOfTuples1,1);
5478 throw INTERP_KERNEL::Exception(msg);
5481 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5483 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5486 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5488 std::ostringstream oss;
5489 self->reprQuickOverview(oss);
5493 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5495 return self->iterator();
5498 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5500 char tmp[2]; tmp[1]='\0';
5501 tmp[0]=self->getIJ(tupleId,compoId);
5502 return std::string(tmp);
5505 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5507 char tmp[2]; tmp[1]='\0';
5508 tmp[0]=self->getIJSafe(tupleId,compoId);
5509 return std::string(tmp);
5512 std::string __str__() const throw(INTERP_KERNEL::Exception)
5514 return self->repr();
5517 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5519 const char *vals=self->getConstPointer();
5520 int nbOfComp=self->getNumberOfComponents();
5521 int nbOfTuples=self->getNumberOfTuples();
5522 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5525 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5527 if(PyString_Check(tupl))
5529 Py_ssize_t sz=PyString_Size(tupl);
5530 std::vector<char> vals(sz);
5531 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5532 return self->presenceOfTuple(vals);
5535 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5538 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5540 if(PyString_Check(vals))
5542 Py_ssize_t sz=PyString_Size(vals);
5543 std::vector<char> vals2(sz);
5544 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5545 return self->presenceOfValue(vals2);
5548 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5551 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5553 if(PyString_Check(vals))
5555 Py_ssize_t sz=PyString_Size(vals);
5556 std::vector<char> vals2(sz);
5557 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5558 return self->findIdFirstEqual(vals2);
5561 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5564 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5566 if(PyString_Check(tupl))
5568 Py_ssize_t sz=PyString_Size(tupl);
5569 std::vector<char> vals(sz);
5570 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5571 return self->findIdFirstEqualTuple(vals);
5574 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5577 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5579 if(PyString_Check(strOrListOfInt))
5581 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5582 std::vector<char> vals(sz);
5583 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5584 return self->findIdSequence(vals);
5587 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5590 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5592 int sz=self->getNumberOfComponents();
5593 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5594 self->getTuple(tupleId,tmp);
5595 return PyString_FromString(tmp);
5598 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5601 char tmp2[2]; tmp2[1]='\0';
5602 tmp2[0]=self->getMaxValue(tmp);
5603 PyObject *ret=PyTuple_New(2);
5604 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5605 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5609 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5612 char tmp2[2]; tmp2[1]='\0';
5613 tmp2[0]=self->getMinValue(tmp);
5614 PyObject *ret=PyTuple_New(2);
5615 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5616 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5620 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5622 int nbOfCompo=self->getNumberOfComponents();
5627 if(PyString_Check(obj))
5629 Py_ssize_t sz=PyString_Size(obj);
5630 char *pt=PyString_AsString(obj);
5632 return self->findIdFirstEqual(pt[0]);
5634 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5637 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5640 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5644 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5646 int nbOfCompo=self->getNumberOfComponents();
5653 if(PyString_Check(obj))
5655 Py_ssize_t sz=PyString_Size(obj);
5656 char *pt=PyString_AsString(obj);
5658 return self->presenceOfValue(pt[0]);
5660 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5663 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5666 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5670 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5673 std::vector<int> stdvecTyyppArr;
5674 std::pair<int, std::pair<int,int> > sTyyppArr;
5675 MEDCoupling::DataArrayInt *daIntTyypp=0;
5676 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5680 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5682 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5684 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5686 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5688 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5692 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5694 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.";
5696 std::vector<int> stdvecTyyppArr;
5697 std::pair<int, std::pair<int,int> > sTyyppArr;
5698 MEDCoupling::DataArrayInt *daIntTyypp=0;
5699 int nbOfCompo=self->getNumberOfComponents();
5700 int nbOfTuples=self->getNumberOfTuples();
5701 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5703 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5704 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5713 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5719 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5720 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5723 //value vector<string>
5726 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5727 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5730 //value DataArrayChar
5733 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5737 throw INTERP_KERNEL::Exception(msg);
5741 {//obj list-tuple[int]
5747 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5753 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5754 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5757 //value vector<string>
5760 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5761 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5764 //value DataArrayChar
5767 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5771 throw INTERP_KERNEL::Exception(msg);
5782 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5788 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5789 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5792 //value vector<string>
5795 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5796 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5799 //value DataArrayChar
5802 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5806 throw INTERP_KERNEL::Exception(msg);
5817 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5823 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5824 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5827 //value vector<string>
5830 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5831 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5834 //value DataArrayChar
5837 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5841 throw INTERP_KERNEL::Exception(msg);
5846 throw INTERP_KERNEL::Exception(msg);
5852 class DataArrayAsciiCharTuple;
5854 class DataArrayAsciiCharIterator
5857 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5858 ~DataArrayAsciiCharIterator();
5863 DataArrayAsciiCharTuple *ret=self->nextt();
5865 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5868 PyErr_SetString(PyExc_StopIteration,"No more data.");
5875 class DataArrayAsciiCharTuple
5878 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5879 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5882 std::string __str__() const throw(INTERP_KERNEL::Exception)
5884 return self->repr();
5887 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5889 return self->buildDAAsciiChar(1,self->getNumberOfCompo());