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 (EDF R&D)
22 %typemap(out) MEDCoupling::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) MEDCoupling::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
44 %typemap(out) MCAuto<MEDCoupling::DataArrayInt>
46 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN|0);
49 %typemap(out) MCAuto<MEDCoupling::DataArrayDouble>
51 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN|0);
54 %typemap(out) MCAuto<MEDCoupling::DataArrayFloat>
56 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayFloat,SWIG_POINTER_OWN|0);
59 %typemap(out) MCAuto<MEDCoupling::MapII>
61 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__MapII,SWIG_POINTER_OWN|0);
65 %newobject MEDCoupling::DataArray::deepCopy;
66 %newobject MEDCoupling::DataArray::buildNewEmptyInstance;
67 %newobject MEDCoupling::DataArray::selectByTupleRanges;
68 %newobject MEDCoupling::DataArray::selectByTupleId;
69 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
70 %newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
71 %newobject MEDCoupling::DataArray::Aggregate;
72 %newobject MEDCoupling::DataArrayFloat::New;
73 %newobject MEDCoupling::DataArrayFloat::iterator;
74 %newobject MEDCoupling::DataArrayFloat::__iter__;
75 %newobject MEDCoupling::DataArrayFloat::Meld;
76 %newobject MEDCoupling::DataArrayFloat::__rmul__;
77 %newobject MEDCoupling::DataArrayInt::New;
78 %newobject MEDCoupling::DataArrayInt::__iter__;
79 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
80 %newobject MEDCoupling::DataArrayInt::subArray;
81 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
82 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
83 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
84 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
85 %newobject MEDCoupling::DataArrayInt::renumber;
86 %newobject MEDCoupling::DataArrayInt::renumberR;
87 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
88 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
89 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
90 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
91 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
92 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
93 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
94 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
95 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
96 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
97 %newobject MEDCoupling::DataArrayInt::negate;
98 %newobject MEDCoupling::DataArrayInt::computeAbs;
99 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
100 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
101 %newobject MEDCoupling::DataArrayInt::findIdsStrictlyNegative;
102 %newobject MEDCoupling::DataArrayInt::Aggregate;
103 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
104 %newobject MEDCoupling::DataArrayInt::Meld;
105 %newobject MEDCoupling::DataArrayInt::Add;
106 %newobject MEDCoupling::DataArrayInt::Substract;
107 %newobject MEDCoupling::DataArrayInt::Multiply;
108 %newobject MEDCoupling::DataArrayInt::Divide;
109 %newobject MEDCoupling::DataArrayInt::Pow;
110 %newobject MEDCoupling::DataArrayInt::BuildUnion;
111 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
112 %newobject MEDCoupling::DataArrayInt::Range;
113 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
114 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
115 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
116 %newobject MEDCoupling::DataArrayInt::buildComplement;
117 %newobject MEDCoupling::DataArrayInt::buildUnion;
118 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
119 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
120 %newobject MEDCoupling::DataArrayInt::buildIntersection;
121 %newobject MEDCoupling::DataArrayInt::buildUnique;
122 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
123 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
124 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
125 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
126 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
127 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
128 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
129 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
130 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
131 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
132 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
133 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
134 %newobject MEDCoupling::DataArrayInt::__neg__;
135 %newobject MEDCoupling::DataArrayInt::__add__;
136 %newobject MEDCoupling::DataArrayInt::__radd__;
137 %newobject MEDCoupling::DataArrayInt::__sub__;
138 %newobject MEDCoupling::DataArrayInt::__rsub__;
139 %newobject MEDCoupling::DataArrayInt::__mul__;
140 %newobject MEDCoupling::DataArrayInt::__rmul__;
141 %newobject MEDCoupling::DataArrayInt::__div__;
142 %newobject MEDCoupling::DataArrayInt::__rdiv__;
143 %newobject MEDCoupling::DataArrayInt::__mod__;
144 %newobject MEDCoupling::DataArrayInt::__rmod__;
145 %newobject MEDCoupling::DataArrayInt::__pow__;
146 %newobject MEDCoupling::DataArrayInt::__rpow__;
147 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
148 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
149 %newobject MEDCoupling::DataArrayChar::renumber;
150 %newobject MEDCoupling::DataArrayChar::renumberR;
151 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
152 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
153 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
154 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
155 %newobject MEDCoupling::DataArrayChar::Aggregate;
156 %newobject MEDCoupling::DataArrayChar::Meld;
157 %newobject MEDCoupling::DataArrayByte::New;
158 %newobject MEDCoupling::DataArrayByte::__iter__;
159 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
160 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
161 %newobject MEDCoupling::DataArrayChar::subArray;
162 %newobject MEDCoupling::DataArrayAsciiChar::New;
163 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
164 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
165 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
166 %newobject MEDCoupling::DataArrayDouble::New;
167 %newobject MEDCoupling::DataArrayDouble::__iter__;
168 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
169 %newobject MEDCoupling::DataArrayDouble::Aggregate;
170 %newobject MEDCoupling::DataArrayDouble::Meld;
171 %newobject MEDCoupling::DataArrayDouble::Dot;
172 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
173 %newobject MEDCoupling::DataArrayDouble::Add;
174 %newobject MEDCoupling::DataArrayDouble::Substract;
175 %newobject MEDCoupling::DataArrayDouble::Multiply;
176 %newobject MEDCoupling::DataArrayDouble::Divide;
177 %newobject MEDCoupling::DataArrayDouble::Pow;
178 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
179 %newobject MEDCoupling::DataArrayDouble::subArray;
180 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
181 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
182 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
183 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
184 %newobject MEDCoupling::DataArrayDouble::findIdsStrictlyNegative;
185 %newobject MEDCoupling::DataArrayDouble::negate;
186 %newobject MEDCoupling::DataArrayDouble::computeAbs;
187 %newobject MEDCoupling::DataArrayDouble::applyFunc;
188 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
189 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
190 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
191 %newobject MEDCoupling::DataArrayDouble::determinant;
192 %newobject MEDCoupling::DataArrayDouble::eigenValues;
193 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
194 %newobject MEDCoupling::DataArrayDouble::inverse;
195 %newobject MEDCoupling::DataArrayDouble::trace;
196 %newobject MEDCoupling::DataArrayDouble::deviator;
197 %newobject MEDCoupling::DataArrayDouble::magnitude;
198 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
199 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
200 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
201 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
202 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
203 %newobject MEDCoupling::DataArrayDouble::renumber;
204 %newobject MEDCoupling::DataArrayDouble::renumberR;
205 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
206 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
207 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
208 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
209 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
210 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
211 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
212 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
213 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
214 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
215 %newobject MEDCoupling::DataArrayDouble::cartesianize;
216 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
217 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
218 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
219 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
220 %newobject MEDCoupling::DataArrayDouble::__neg__;
221 %newobject MEDCoupling::DataArrayDouble::__radd__;
222 %newobject MEDCoupling::DataArrayDouble::__rsub__;
223 %newobject MEDCoupling::DataArrayDouble::__rmul__;
224 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
225 %newobject MEDCoupling::DataArrayDouble::__pow__;
226 %newobject MEDCoupling::DataArrayDouble::__rpow__;
227 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
229 %newobject MEDCoupling::PartDefinition::New;
230 %newobject MEDCoupling::PartDefinition::toDAI;
231 %newobject MEDCoupling::PartDefinition::__add__;
232 %newobject MEDCoupling::PartDefinition::composeWith;
233 %newobject MEDCoupling::PartDefinition::tryToSimplify;
234 %newobject MEDCoupling::DataArrayPartDefinition::New;
235 %newobject MEDCoupling::SlicePartDefinition::New;
238 %feature("unref") DataArray "$this->decrRef();"
239 %feature("unref") DataArrayDouble "$this->decrRef();"
240 %feature("unref") DataArrayInt "$this->decrRef();"
241 %feature("unref") DataArrayChar "$this->decrRef();"
242 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
243 %feature("unref") DataArrayByte "$this->decrRef();"
245 %feature("unref") MapII "$this->decrRef();"
246 %feature("unref") PartDefinition "$this->decrRef();"
247 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
248 %feature("unref") SlicePartDefinition "$this->decrRef();"
250 namespace MEDCoupling
257 } MEDCouplingAxisType;
261 class MapII : public RefCountObject, public TimeLabel
264 static MCAuto< MapII > New();
267 class PartDefinition : public RefCountObject, public TimeLabel
270 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
271 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
272 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
273 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
274 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
275 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
276 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
277 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
280 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
282 return (*self)+other;
285 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
288 bool ret0(self->isEqual(other,ret1));
289 PyObject *ret=PyTuple_New(2);
290 PyObject *ret0Py=ret0?Py_True:Py_False;
292 PyTuple_SetItem(ret,0,ret0Py);
293 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
297 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
299 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
303 virtual ~PartDefinition();
306 class DataArrayPartDefinition : public PartDefinition
309 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
312 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
314 return DataArrayPartDefinition::New(listOfIds);
317 std::string __str__() const throw(INTERP_KERNEL::Exception)
319 return self->getRepr();
322 std::string __repr__() const throw(INTERP_KERNEL::Exception)
324 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
325 oss << self->getRepr();
330 virtual ~DataArrayPartDefinition();
333 class SlicePartDefinition : public PartDefinition
336 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
337 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
340 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
342 return SlicePartDefinition::New(start,stop,step);
345 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
348 self->getSlice(a,b,c);
349 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
352 std::string __str__() const throw(INTERP_KERNEL::Exception)
354 return self->getRepr();
357 std::string __repr__() const throw(INTERP_KERNEL::Exception)
359 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
360 oss << self->getRepr();
365 virtual ~SlicePartDefinition();
368 class DataArray : public RefCountObject, public TimeLabel
371 void setName(const std::string& name);
372 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
373 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
374 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
375 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
376 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
377 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
378 std::string getName() const;
379 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
380 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
381 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
382 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
383 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
384 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
385 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
386 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
387 int getNumberOfComponents() const;
388 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
389 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
390 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
391 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
392 virtual void desallocate() throw(INTERP_KERNEL::Exception);
393 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
394 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
395 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
396 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
397 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
398 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
399 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
400 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
401 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
402 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
403 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
404 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
405 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
406 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
407 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
408 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
409 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
410 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
411 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
412 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
413 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
414 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
415 void updateTime() const;
418 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
420 const std::vector<std::string>& comps=self->getInfoOnComponents();
421 PyObject *ret=PyList_New((int)comps.size());
422 for(int i=0;i<(int)comps.size();i++)
423 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
427 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
429 std::vector<int> tmp;
430 convertPyToNewIntArr3(li,tmp);
431 self->copyPartOfStringInfoFrom(other,tmp);
434 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
436 std::vector<int> tmp;
437 convertPyToNewIntArr3(li,tmp);
438 self->copyPartOfStringInfoFrom2(tmp,other);
441 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
444 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
445 if (!SWIG_IsOK(res1))
448 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
449 if(size!=self->getNumberOfTuples())
451 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
453 self->renumberInPlace(tmp);
457 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
459 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
460 da2->checkAllocated();
461 int size=self->getNumberOfTuples();
462 if(size!=self->getNumberOfTuples())
464 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
466 self->renumberInPlace(da2->getConstPointer());
470 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
473 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
474 if (!SWIG_IsOK(res1))
477 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
478 if(size!=self->getNumberOfTuples())
480 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
482 self->renumberInPlaceR(tmp);
486 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
488 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
489 da2->checkAllocated();
490 int size=self->getNumberOfTuples();
491 if(size!=self->getNumberOfTuples())
493 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
495 self->renumberInPlaceR(da2->getConstPointer());
499 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
500 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
502 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
503 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
504 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
505 DataArrayInt *tuplesSelecPtr2=0;
508 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
510 throw INTERP_KERNEL::Exception(msg);
512 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
515 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
517 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
518 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
521 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
523 std::vector<std::pair<int,int> > ranges;
524 convertPyToVectorPairInt(li,ranges);
525 return self->selectByTupleRanges(ranges);
528 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
531 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
532 if (!SWIG_IsOK(res1))
535 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
536 return self->selectByTupleId(tmp,tmp+size);
540 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
542 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
543 da2->checkAllocated();
544 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
548 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
551 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
552 if (!SWIG_IsOK(res1))
555 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
556 return self->selectByTupleIdSafe(tmp,tmp+size);
560 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
562 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
563 da2->checkAllocated();
564 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
568 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
570 std::vector<int> tmp;
571 convertPyToNewIntArr3(li,tmp);
572 DataArray *ret=self->keepSelectedComponents(tmp);
573 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
576 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
578 if(!PySlice_Check(slic))
579 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
580 Py_ssize_t strt=2,stp=2,step=2;
581 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
583 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
584 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
587 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
589 if(!PySlice_Check(slic))
590 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
591 Py_ssize_t strt=2,stp=2,step=2;
592 GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
594 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
595 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
598 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
600 if(!PySlice_Check(slic))
601 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
602 Py_ssize_t strt=2,stp=2,step=2;
603 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
604 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
607 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
609 if(!PySlice_Check(slic))
610 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
611 Py_ssize_t strt=2,stp=2,step=2;
612 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
613 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
616 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
618 std::vector<const DataArray *> tmp;
619 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
620 return DataArray::Aggregate(tmp);
623 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
625 if(!PySlice_Check(slic))
626 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
627 Py_ssize_t strt=2,stp=2,step=2;
628 GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
629 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
632 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
634 if(!PySlice_Check(slic))
635 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
636 Py_ssize_t strt=2,stp=2,step=2;
637 GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
638 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
641 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
643 PyObject *ret(PyTuple_New(2));
644 std::string a0(self->getName());
645 const std::vector<std::string> &a1(self->getInfoOnComponents());
646 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
649 PyObject *ret1(PyList_New(sz));
650 for(int i=0;i<sz;i++)
651 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
652 PyTuple_SetItem(ret,1,ret1);
657 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
659 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 !";
660 if(!PyTuple_Check(inp))
661 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
662 int sz(PyTuple_Size(inp));
664 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
665 PyObject *a0(PyTuple_GetItem(inp,0));
666 self->setName(convertPyObjectToStr(a0,MSG));
667 PyObject *a1(PyTuple_GetItem(inp,1));
668 std::vector<std::string> a1cpp;
669 if(!fillStringVector(a1,a1cpp))
670 throw INTERP_KERNEL::Exception(MSG);
671 self->setInfoOnComponents(a1cpp);
676 class DataArrayDouble;
678 class DataArrayFloat : public DataArray
681 static DataArrayFloat *New();
682 void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
683 bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
684 bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
685 bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
686 void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
687 void iota(float init=0.) throw(INTERP_KERNEL::Exception);
688 DataArrayFloatIterator *iterator() throw(INTERP_KERNEL::Exception);
689 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
690 static DataArrayFloat *Meld(const DataArrayFloat *a1, const DataArrayFloat *a2) throw(INTERP_KERNEL::Exception);
693 DataArrayFloat() throw(INTERP_KERNEL::Exception)
695 return DataArrayFloat::New();
698 static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
700 return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
703 DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
705 return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
708 DataArrayFloatIterator *__iter__() throw(INTERP_KERNEL::Exception)
710 return self->iterator();
713 std::string __repr__() const throw(INTERP_KERNEL::Exception)
715 std::ostringstream oss;
716 self->reprQuickOverview(oss);
720 std::string __str__() const throw(INTERP_KERNEL::Exception)
722 return self->reprNotTooLong();
725 int __len__() const throw(INTERP_KERNEL::Exception)
727 if(self->isAllocated())
729 return self->getNumberOfTuples();
733 throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
737 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
739 const float *vals(self->begin());
740 return convertDblArrToPyList<float>(vals,self->getNbOfElems());
743 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
745 const float *vals(self->begin());
746 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
747 return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
750 PyObject *isEqualIfNotWhy(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception)
753 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
754 PyObject *ret=PyTuple_New(2);
755 PyObject *ret0Py=ret0?Py_True:Py_False;
757 PyTuple_SetItem(ret,0,ret0Py);
758 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
762 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
764 return DataArrayT__getitem<float>(self,obj);
767 DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
769 return DataArrayT__setitem__<float>(self,obj,value);
772 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
774 return DataArrayT_iadd<float>(trueSelf,obj,self);
777 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
779 return DataArrayT_isub<float>(trueSelf,obj,self);
782 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
784 return DataArrayT_imul<float>(trueSelf,obj,self);
787 DataArrayFloat *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
789 return DataArrayFPT_rmul<float>(self,obj);
792 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
794 return DataArrayT_idiv<float>(trueSelf,obj,self);
798 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
800 return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
806 class DataArrayFloatTuple;
808 class DataArrayFloatIterator
811 DataArrayFloatIterator(DataArrayFloat *da);
812 ~DataArrayFloatIterator();
817 DataArrayFloatTuple *ret=self->nextt();
819 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple,SWIG_POINTER_OWN|0);
822 PyErr_SetString(PyExc_StopIteration,"No more data.");
829 class DataArrayFloatTuple
832 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
833 DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
836 std::string __str__() const throw(INTERP_KERNEL::Exception)
841 float __float__() const throw(INTERP_KERNEL::Exception)
843 return self->floatValue();
846 DataArrayFloat *buildDAFloat() throw(INTERP_KERNEL::Exception)
848 return self->buildDAFloat(1,self->getNumberOfCompo());
851 /*PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
853 MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
854 MEDCoupling_DataArrayFloat____imul___(ret,0,obj);
855 Py_XINCREF(trueSelf);
859 PyObject *__len__() throw(INTERP_KERNEL::Exception)
861 return PyInt_FromLong(self->getNumberOfCompo());
867 class DataArrayDoubleIterator;
869 class DataArrayDouble : public DataArray
872 static DataArrayDouble *New();
873 double doubleValue() const throw(INTERP_KERNEL::Exception);
874 bool empty() const throw(INTERP_KERNEL::Exception);
875 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
876 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
877 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
878 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
879 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
880 double popBackSilent() throw(INTERP_KERNEL::Exception);
881 void pack() const throw(INTERP_KERNEL::Exception);
882 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
883 void fillWithZero() throw(INTERP_KERNEL::Exception);
884 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
885 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
886 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
887 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
888 void reverse() throw(INTERP_KERNEL::Exception);
889 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
890 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
891 std::string repr() const throw(INTERP_KERNEL::Exception);
892 std::string reprZip() const throw(INTERP_KERNEL::Exception);
893 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
894 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
895 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
896 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
897 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
898 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
899 void transpose() throw(INTERP_KERNEL::Exception);
900 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
901 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
902 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
903 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
904 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
905 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
906 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
907 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
908 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
909 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
910 double front() const throw(INTERP_KERNEL::Exception);
911 double back() const throw(INTERP_KERNEL::Exception);
912 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
913 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
914 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
915 double *getPointer() throw(INTERP_KERNEL::Exception);
916 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
917 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
918 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
919 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
920 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
921 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
922 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
923 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
924 double getAverageValue() const throw(INTERP_KERNEL::Exception);
925 double norm2() const throw(INTERP_KERNEL::Exception);
926 double normMax() const throw(INTERP_KERNEL::Exception);
927 double normMin() const throw(INTERP_KERNEL::Exception);
928 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
929 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
930 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
931 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
932 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
933 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
934 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
935 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
936 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
937 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
938 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
939 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
940 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
941 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
942 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
943 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
944 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
945 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
946 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
947 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
948 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
949 void abs() throw(INTERP_KERNEL::Exception);
950 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
951 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
952 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
953 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
954 void applyPow(double val) throw(INTERP_KERNEL::Exception);
955 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
956 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
957 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
958 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
959 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
960 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
961 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
962 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
963 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
964 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
965 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
966 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
967 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
968 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
969 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
970 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
971 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
972 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
973 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
974 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
975 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
976 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
977 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
978 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
979 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
980 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
981 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
982 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
983 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
984 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
985 MCAuto<DataArrayInt> findIdsGreaterThan(double val) const throw(INTERP_KERNEL::Exception);
986 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
987 MCAuto<DataArrayInt> findIdsLowerThan(double val) const throw(INTERP_KERNEL::Exception);
988 MCAuto<DataArrayInt> convertToIntArr() const throw(INTERP_KERNEL::Exception);
989 MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
990 MCAuto<DataArrayDouble> cumSum() const throw(INTERP_KERNEL::Exception);
991 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
994 DataArrayDouble() throw(INTERP_KERNEL::Exception)
996 return DataArrayDouble::New();
999 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1001 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
1004 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1006 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
1009 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
1012 std::vector<double> bb;
1014 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
1015 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
1016 self->pushBackValsSilent(tmp,tmp+nbTuples);
1019 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1021 std::ostringstream oss;
1022 self->reprQuickOverview(oss);
1026 std::string __str__() const throw(INTERP_KERNEL::Exception)
1028 return self->reprNotTooLong();
1031 double __float__() const throw(INTERP_KERNEL::Exception)
1033 return self->doubleValue();
1036 int __len__() const throw(INTERP_KERNEL::Exception)
1038 if(self->isAllocated())
1040 return self->getNumberOfTuples();
1044 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
1048 PyObject *asArcOfCircle() const throw(INTERP_KERNEL::Exception)
1050 double center[2],radius,ang;
1051 self->asArcOfCircle(center,radius,ang);
1052 PyObject *ret(PyTuple_New(3));
1054 PyObject *ret0(PyList_New(2));
1055 PyList_SetItem(ret0,0,PyFloat_FromDouble(center[0]));
1056 PyList_SetItem(ret0,1,PyFloat_FromDouble(center[1]));
1057 PyTuple_SetItem(ret,0,ret0);
1059 PyTuple_SetItem(ret,1,PyFloat_FromDouble(radius));
1060 PyTuple_SetItem(ret,2,PyFloat_FromDouble(ang));
1064 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
1066 return self->iterator();
1069 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1071 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 !";
1072 if(PyList_Check(li) || PyTuple_Check(li))
1076 if(PyInt_Check(nbOfTuples))
1078 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1080 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
1083 if(PyInt_Check(nbOfComp))
1084 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
1085 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1087 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
1088 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
1089 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1092 throw INTERP_KERNEL::Exception(msg);
1095 {//DataArrayDouble.setValues([1.,3.,4.],3)
1097 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
1098 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1102 throw INTERP_KERNEL::Exception(msg);
1105 {// DataArrayDouble.setValues([1.,3.,4.])
1106 int tmpp1=-1,tmpp2=-1;
1107 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
1108 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1112 throw INTERP_KERNEL::Exception(msg);
1115 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
1117 const double *vals(self->begin());
1118 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
1122 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
1124 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1128 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1131 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1132 PyObject *ret=PyTuple_New(2);
1133 PyObject *ret0Py=ret0?Py_True:Py_False;
1135 PyTuple_SetItem(ret,0,ret0Py);
1136 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1140 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1142 const double *vals(self->begin());
1143 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1144 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1147 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1149 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1151 DataArrayDouble *a,*a2;
1152 DataArrayDoubleTuple *aa,*aa2;
1153 std::vector<double> bb,bb2;
1155 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1156 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1157 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1161 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1163 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1165 DataArrayDouble *a,*a2;
1166 DataArrayDoubleTuple *aa,*aa2;
1167 std::vector<double> bb,bb2;
1169 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1171 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1172 return convertDblArrToPyListOfTuple<double>(res,3,3);
1175 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1177 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1179 DataArrayDouble *a,*a2;
1180 DataArrayDoubleTuple *aa,*aa2;
1181 std::vector<double> bb,bb2;
1183 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1184 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1185 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1188 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1191 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1192 if (!SWIG_IsOK(res1))
1195 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1196 if(size!=self->getNumberOfTuples())
1198 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1200 return self->renumber(tmp);
1204 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1206 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1207 da2->checkAllocated();
1208 int size=self->getNumberOfTuples();
1209 if(size!=self->getNumberOfTuples())
1211 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1213 return self->renumber(da2->getConstPointer());
1217 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1220 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1221 if (!SWIG_IsOK(res1))
1224 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1225 if(size!=self->getNumberOfTuples())
1227 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1229 return self->renumberR(tmp);
1233 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1235 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1236 da2->checkAllocated();
1237 int size=self->getNumberOfTuples();
1238 if(size!=self->getNumberOfTuples())
1240 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1242 return self->renumberR(da2->getConstPointer());
1246 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1249 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1250 if (!SWIG_IsOK(res1))
1253 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1254 if(size!=self->getNumberOfTuples())
1256 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1258 return self->renumberAndReduce(tmp,newNbOfTuple);
1262 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1264 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1265 da2->checkAllocated();
1266 int size=self->getNumberOfTuples();
1267 if(size!=self->getNumberOfTuples())
1269 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1271 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1275 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1277 int thisTupleId,otherTupleId;
1278 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1279 PyObject *ret=PyTuple_New(3);
1280 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1281 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1282 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1286 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1289 double r1=self->getMaxValue(tmp);
1290 PyObject *ret=PyTuple_New(2);
1291 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1292 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1296 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1299 double r1=self->getMaxValue2(tmp);
1300 PyObject *ret=PyTuple_New(2);
1301 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1302 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1306 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1309 double r1=self->getMinValue(tmp);
1310 PyObject *ret=PyTuple_New(2);
1311 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1312 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1316 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1319 double r1=self->getMinValue2(tmp);
1320 PyObject *ret=PyTuple_New(2);
1321 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1322 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1326 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1328 int nbOfCompo(self->getNumberOfComponents());
1329 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1330 self->getMinMaxPerComponent(tmp);
1331 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1335 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1337 int sz=self->getNumberOfComponents();
1338 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1339 self->accumulate(tmp);
1340 return convertDblArrToPyList<double>(tmp,sz);
1343 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1346 std::vector<int> val2;
1347 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1348 return self->accumulatePerChunck(bg,bg+sz);
1351 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1353 DataArrayInt *comm, *commIndex;
1354 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1355 PyObject *res = PyList_New(2);
1356 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1357 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1361 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1365 DataArrayDoubleTuple *aa;
1366 std::vector<double> bb;
1368 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1369 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1371 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1372 PyObject *ret=PyTuple_New(2);
1373 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1374 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1378 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1380 std::vector<int> tmp;
1381 convertPyToNewIntArr3(li,tmp);
1382 self->setSelectedComponents(a,tmp);
1385 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1387 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1388 std::size_t sz(retCpp.size());
1389 PyObject *res(PyList_New(sz));
1390 for(std::size_t i=0;i<sz;i++)
1391 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1395 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1397 int sz=self->getNumberOfComponents();
1398 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1399 self->getTuple(tupleId,tmp);
1400 return convertDblArrToPyList<double>(tmp,sz);
1403 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1405 std::vector<const DataArrayDouble *> tmp;
1406 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1407 return DataArrayDouble::Aggregate(tmp);
1410 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1412 std::vector<const DataArrayDouble *> tmp;
1413 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1414 return DataArrayDouble::Meld(tmp);
1417 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1421 DataArrayDoubleTuple *aa;
1422 std::vector<double> bb;
1424 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1425 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1426 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1427 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1428 DataArrayInt *c=0,*cI=0;
1429 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1430 PyObject *ret=PyTuple_New(2);
1431 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1432 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1436 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1438 DataArrayInt *ret1=0;
1439 bool ret0=self->areIncludedInMe(other,prec,ret1);
1440 PyObject *ret=PyTuple_New(2);
1441 PyObject *ret0Py=ret0?Py_True:Py_False;
1443 PyTuple_SetItem(ret,0,ret0Py);
1444 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1448 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1450 return DataArrayT__getitem<double>(self,obj);
1453 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1455 return DataArrayT__setitem__<double>(self,obj,value);
1458 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1460 return self->negate();
1463 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1465 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1468 DataArrayDoubleTuple *aa;
1469 std::vector<double> bb;
1472 #ifndef WITHOUT_AUTOFIELD
1474 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1476 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1479 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1480 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1482 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1485 throw INTERP_KERNEL::Exception(msg);
1489 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1494 MCAuto<DataArrayDouble> ret=self->deepCopy();
1495 ret->applyLin(1.,val);
1496 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1500 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1504 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1505 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1509 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1510 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1513 throw INTERP_KERNEL::Exception(msg);
1517 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1519 const char msg[]="Unexpected situation in __radd__ !";
1522 DataArrayDoubleTuple *aa;
1523 std::vector<double> bb;
1525 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1530 MCAuto<DataArrayDouble> ret=self->deepCopy();
1531 ret->applyLin(1.,val);
1536 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1537 return DataArrayDouble::Add(self,aaa);
1541 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1542 return DataArrayDouble::Add(self,aaa);
1545 throw INTERP_KERNEL::Exception(msg);
1549 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1551 return DataArrayT_iadd<double>(trueSelf,obj,self);
1554 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1556 const char msg[]="Unexpected situation in __sub__ !";
1559 DataArrayDoubleTuple *aa;
1560 std::vector<double> bb;
1563 #ifndef WITHOUT_AUTOFIELD
1565 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1567 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1570 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1571 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1573 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1576 throw INTERP_KERNEL::Exception(msg);
1580 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1585 MCAuto<DataArrayDouble> ret=self->deepCopy();
1586 ret->applyLin(1.,-val);
1587 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1591 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1595 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1596 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1600 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1601 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1604 throw INTERP_KERNEL::Exception(msg);
1608 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1610 const char msg[]="Unexpected situation in __rsub__ !";
1613 DataArrayDoubleTuple *aa;
1614 std::vector<double> bb;
1616 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1621 MCAuto<DataArrayDouble> ret=self->deepCopy();
1622 ret->applyLin(-1.,val);
1627 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1628 return DataArrayDouble::Substract(aaa,self);
1632 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1633 return DataArrayDouble::Substract(aaa,self);
1636 throw INTERP_KERNEL::Exception(msg);
1640 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1642 return DataArrayT_isub<double>(trueSelf,obj,self);
1645 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1647 const char msg[]="Unexpected situation in __mul__ !";
1650 DataArrayDoubleTuple *aa;
1651 std::vector<double> bb;
1654 #ifndef WITHOUT_AUTOFIELD
1656 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1658 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1661 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1662 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1664 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1667 throw INTERP_KERNEL::Exception(msg);
1671 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1676 MCAuto<DataArrayDouble> ret=self->deepCopy();
1677 ret->applyLin(val,0.);
1678 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1682 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1686 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1687 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1691 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1692 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1695 throw INTERP_KERNEL::Exception(msg);
1699 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1701 return DataArrayFPT_rmul<double>(self,obj);
1704 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1706 return DataArrayT_imul<double>(trueSelf,obj,self);
1709 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1711 const char msg[]="Unexpected situation in __div__ !";
1714 DataArrayDoubleTuple *aa;
1715 std::vector<double> bb;
1718 #ifndef WITHOUT_AUTOFIELD
1720 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1722 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1725 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1726 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1728 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1731 throw INTERP_KERNEL::Exception(msg);
1735 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1741 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1742 MCAuto<DataArrayDouble> ret=self->deepCopy();
1743 ret->applyLin(1/val,0.);
1744 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1748 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1752 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1753 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1757 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1758 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1761 throw INTERP_KERNEL::Exception(msg);
1765 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1767 const char msg[]="Unexpected situation in __rdiv__ !";
1770 DataArrayDoubleTuple *aa;
1771 std::vector<double> bb;
1773 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1778 MCAuto<DataArrayDouble> ret=self->deepCopy();
1784 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1785 return DataArrayDouble::Divide(aaa,self);
1789 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1790 return DataArrayDouble::Divide(aaa,self);
1793 throw INTERP_KERNEL::Exception(msg);
1797 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1799 return DataArrayT_idiv<double>(trueSelf,obj,self);
1802 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1804 const char msg[]="Unexpected situation in __pow__ !";
1807 DataArrayDoubleTuple *aa;
1808 std::vector<double> bb;
1810 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1815 MCAuto<DataArrayDouble> ret=self->deepCopy();
1821 return DataArrayDouble::Pow(self,a);
1825 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1826 return DataArrayDouble::Pow(self,aaa);
1830 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1831 return DataArrayDouble::Pow(self,aaa);
1834 throw INTERP_KERNEL::Exception(msg);
1838 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1840 const char msg[]="Unexpected situation in __rpow__ !";
1843 DataArrayDoubleTuple *aa;
1844 std::vector<double> bb;
1846 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1851 MCAuto<DataArrayDouble> ret=self->deepCopy();
1852 ret->applyRPow(val);
1857 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1858 return DataArrayDouble::Pow(aaa,self);
1862 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1863 return DataArrayDouble::Pow(aaa,self);
1866 throw INTERP_KERNEL::Exception(msg);
1870 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1872 const char msg[]="Unexpected situation in __ipow__ !";
1875 DataArrayDoubleTuple *aa;
1876 std::vector<double> bb;
1878 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1883 self->applyPow(val);
1884 Py_XINCREF(trueSelf);
1890 Py_XINCREF(trueSelf);
1895 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1896 self->powEqual(aaa);
1897 Py_XINCREF(trueSelf);
1902 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1903 self->powEqual(aaa);
1904 Py_XINCREF(trueSelf);
1908 throw INTERP_KERNEL::Exception(msg);
1912 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1914 DataArrayInt *c=0,*cI=0;
1916 self->computeTupleIdsNearTuples(other,eps,c,cI);
1917 PyObject *ret=PyTuple_New(2);
1918 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1919 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1923 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1925 DataArrayInt *ret1=0;
1926 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1927 PyObject *ret=PyTuple_New(2);
1928 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1929 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1935 class DataArrayDoubleTuple;
1937 class DataArrayDoubleIterator
1940 DataArrayDoubleIterator(DataArrayDouble *da);
1941 ~DataArrayDoubleIterator();
1946 DataArrayDoubleTuple *ret=self->nextt();
1948 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1951 PyErr_SetString(PyExc_StopIteration,"No more data.");
1958 class DataArrayDoubleTuple
1961 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
1962 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
1965 std::string __str__() const throw(INTERP_KERNEL::Exception)
1967 return self->repr();
1970 double __float__() const throw(INTERP_KERNEL::Exception)
1972 return self->doubleValue();
1975 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
1977 return self->buildDADouble(1,self->getNumberOfCompo());
1980 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1982 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
1983 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
1984 Py_XINCREF(trueSelf);
1988 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1990 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
1991 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
1992 Py_XINCREF(trueSelf);
1996 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1998 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
1999 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2000 Py_XINCREF(trueSelf);
2004 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2006 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2007 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2008 Py_XINCREF(trueSelf);
2012 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2014 return PyInt_FromLong(self->getNumberOfCompo());
2017 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2019 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2022 std::vector<int> multiVal;
2023 std::pair<int, std::pair<int,int> > slic;
2024 MEDCoupling::DataArrayInt *daIntTyypp=0;
2025 const double *pt=self->getConstPointer();
2026 int nbc=self->getNumberOfCompo();
2027 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2034 std::ostringstream oss;
2035 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2036 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2040 return PyFloat_FromDouble(pt[singleVal]);
2044 return PyFloat_FromDouble(pt[nbc+singleVal]);
2047 std::ostringstream oss;
2048 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2049 throw INTERP_KERNEL::Exception(oss.str().c_str());
2055 PyObject *t=PyTuple_New(multiVal.size());
2056 for(int j=0;j<(int)multiVal.size();j++)
2058 int cid=multiVal[j];
2061 std::ostringstream oss;
2062 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2063 throw INTERP_KERNEL::Exception(oss.str().c_str());
2065 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2071 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2072 PyObject *t=PyTuple_New(sz);
2073 for(int j=0;j<sz;j++)
2074 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2078 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2082 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2084 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2085 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2088 std::vector<double> multiValV;
2089 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2090 int nbc=self->getNumberOfCompo();
2091 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2093 std::vector<int> multiVal;
2094 std::pair<int, std::pair<int,int> > slic;
2095 MEDCoupling::DataArrayInt *daIntTyypp=0;
2096 double *pt=self->getPointer();
2097 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2104 std::ostringstream oss;
2105 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2106 throw INTERP_KERNEL::Exception(oss.str().c_str());
2112 pt[singleVal]=singleValV;
2117 if(multiValV.size()!=1)
2119 std::ostringstream oss;
2120 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2121 throw INTERP_KERNEL::Exception(oss.str().c_str());
2123 pt[singleVal]=multiValV[0];
2128 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2132 throw INTERP_KERNEL::Exception(msg);
2141 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2145 std::ostringstream oss;
2146 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2147 throw INTERP_KERNEL::Exception(oss.str().c_str());
2155 if(multiVal.size()!=multiValV.size())
2157 std::ostringstream oss;
2158 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2159 throw INTERP_KERNEL::Exception(oss.str().c_str());
2161 for(int i=0;i<(int)multiVal.size();i++)
2163 int pos=multiVal[i];
2166 std::ostringstream oss;
2167 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2168 throw INTERP_KERNEL::Exception(oss.str().c_str());
2170 pt[multiVal[i]]=multiValV[i];
2176 const double *ptV=daIntTyyppV->getConstPointer();
2177 if(nbc>daIntTyyppV->getNumberOfCompo())
2179 std::ostringstream oss;
2180 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2181 throw INTERP_KERNEL::Exception(oss.str().c_str());
2183 std::copy(ptV,ptV+nbc,pt);
2187 throw INTERP_KERNEL::Exception(msg);
2192 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2197 for(int j=0;j<sz;j++)
2198 pt[slic.first+j*slic.second.second]=singleValV;
2203 if(sz!=(int)multiValV.size())
2205 std::ostringstream oss;
2206 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2207 throw INTERP_KERNEL::Exception(oss.str().c_str());
2209 for(int j=0;j<sz;j++)
2210 pt[slic.first+j*slic.second.second]=multiValV[j];
2215 const double *ptV=daIntTyyppV->getConstPointer();
2216 if(sz>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 for(int j=0;j<sz;j++)
2223 pt[slic.first+j*slic.second.second]=ptV[j];
2227 throw INTERP_KERNEL::Exception(msg);
2231 throw INTERP_KERNEL::Exception(msg);
2237 class DataArrayIntIterator;
2239 class DataArrayInt : public DataArray
2242 static DataArrayInt *New();
2243 int intValue() const throw(INTERP_KERNEL::Exception);
2244 int getHashCode() const throw(INTERP_KERNEL::Exception);
2245 bool empty() const throw(INTERP_KERNEL::Exception);
2246 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2247 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2248 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2249 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2250 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2251 int popBackSilent() throw(INTERP_KERNEL::Exception);
2252 void pack() const throw(INTERP_KERNEL::Exception);
2253 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2254 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2255 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2256 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2257 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2258 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2259 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2260 void reverse() throw(INTERP_KERNEL::Exception);
2261 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2262 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2263 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2264 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2265 void fillWithZero() throw(INTERP_KERNEL::Exception);
2266 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2267 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2268 std::string repr() const throw(INTERP_KERNEL::Exception);
2269 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2270 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2271 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2272 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2273 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2274 MCAuto< MapII > invertArrayN2O2O2NOptimized() const throw(INTERP_KERNEL::Exception);
2275 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2276 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2277 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2278 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2279 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2280 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2281 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2282 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2283 int checkUniformAndGuess() const throw(INTERP_KERNEL::Exception);
2284 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2285 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2286 void transpose() throw(INTERP_KERNEL::Exception);
2287 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2288 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2289 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2290 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2291 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2292 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2293 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2294 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2295 int front() const throw(INTERP_KERNEL::Exception);
2296 int back() const throw(INTERP_KERNEL::Exception);
2297 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2298 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2299 int *getPointer() throw(INTERP_KERNEL::Exception);
2300 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2301 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2302 const int *begin() const throw(INTERP_KERNEL::Exception);
2303 const int *end() const throw(INTERP_KERNEL::Exception);
2304 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2305 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2306 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2307 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2308 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2309 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2310 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2311 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2312 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2313 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2314 int count(int value) const throw(INTERP_KERNEL::Exception);
2315 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2316 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2317 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2318 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2319 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2320 void abs() throw(INTERP_KERNEL::Exception);
2321 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2322 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2323 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2324 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2325 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2326 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2327 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2328 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2329 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2330 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2331 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2332 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2333 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2334 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2335 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2336 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2337 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2338 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2339 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2340 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2341 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2342 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2343 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2344 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2345 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2346 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2347 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2348 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2349 void computeOffsets() throw(INTERP_KERNEL::Exception);
2350 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2351 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2352 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2353 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2354 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2355 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2356 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2357 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2358 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2359 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2360 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2361 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2362 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2363 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2364 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2365 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2366 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2367 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2368 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2369 MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
2370 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2371 MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
2372 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2373 MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
2374 MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
2375 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
2376 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
2378 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2381 DataArrayInt() throw(INTERP_KERNEL::Exception)
2383 return DataArrayInt::New();
2386 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2388 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)";
2389 std::string msg(msgBase);
2391 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2394 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2398 if(PyInt_Check(nbOfTuples))
2400 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2402 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2405 if(PyInt_Check(nbOfComp))
2406 {//DataArrayInt.New([1,3,4,5],2,2)
2407 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2409 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2410 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2411 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2412 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2416 throw INTERP_KERNEL::Exception(msg.c_str());
2419 {//DataArrayInt.New([1,3,4],3)
2420 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2422 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2423 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2428 throw INTERP_KERNEL::Exception(msg.c_str());
2431 {// DataArrayInt.New([1,3,4])
2432 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2433 int tmpp1=-1,tmpp2=-1;
2434 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2435 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2439 else if(PyInt_Check(elt0))
2441 int nbOfTuples1=PyInt_AS_LONG(elt0);
2443 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2448 if(PyInt_Check(nbOfTuples))
2449 {//DataArrayInt.New(5,2)
2450 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2452 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2453 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2454 ret->alloc(nbOfTuples1,nbOfCompo);
2458 throw INTERP_KERNEL::Exception(msg.c_str());
2461 throw INTERP_KERNEL::Exception(msg.c_str());
2464 {//DataArrayInt.New(5)
2465 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2466 ret->alloc(nbOfTuples1,1);
2471 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2472 {//DataArrayInt.New(numpyArray)
2473 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2477 throw INTERP_KERNEL::Exception(msg.c_str());
2478 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2481 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2483 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2486 std::string __str__() const throw(INTERP_KERNEL::Exception)
2488 return self->reprNotTooLong();
2491 int __len__() const throw(INTERP_KERNEL::Exception)
2493 if(self->isAllocated())
2495 return self->getNumberOfTuples();
2499 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2503 int __int__() const throw(INTERP_KERNEL::Exception)
2505 return self->intValue();
2508 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2510 return self->iterator();
2513 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2515 int sz=self->getNumberOfComponents();
2516 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2517 self->accumulate(tmp);
2518 return convertIntArrToPyList(tmp,sz);
2521 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2524 std::vector<int> val2;
2525 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2526 return self->accumulatePerChunck(bg,bg+sz);
2529 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2532 std::vector<int> val2;
2533 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2534 return self->findIdsEqualTuple(bg,bg+sz);
2537 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2539 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2540 PyObject *ret=PyList_New(slcs.size());
2541 for(std::size_t i=0;i<slcs.size();i++)
2542 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2546 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2548 if(!PySlice_Check(slic))
2549 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2550 Py_ssize_t strt=2,stp=2,step=2;
2551 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2552 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2553 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 !");
2554 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2557 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2560 self->getMinMaxValues(a,b);
2561 PyObject *ret=PyTuple_New(2);
2562 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2563 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2567 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2569 int newNbOfTuples=-1;
2570 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2571 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2572 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2573 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2574 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2575 PyObject *ret=PyTuple_New(2);
2576 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2577 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2581 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2583 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2584 int szArr,sw,iTypppArr;
2585 std::vector<int> stdvecTyyppArr;
2586 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2587 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2588 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2592 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2594 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 !";
2595 if(PyList_Check(li) || PyTuple_Check(li))
2597 if(nbOfTuples && nbOfTuples != Py_None)
2599 if(PyInt_Check(nbOfTuples))
2601 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2603 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2604 if(nbOfComp && nbOfComp != Py_None)
2606 if(PyInt_Check(nbOfComp))
2607 {//DataArrayInt.setValues([1,3,4,5],2,2)
2608 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2610 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2611 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2612 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2615 throw INTERP_KERNEL::Exception(msg);
2618 {//DataArrayInt.setValues([1,3,4],3)
2620 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2621 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2625 throw INTERP_KERNEL::Exception(msg);
2628 {// DataArrayInt.setValues([1,3,4])
2629 int tmpp1=-1,tmpp2=-1;
2630 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2631 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2635 throw INTERP_KERNEL::Exception(msg);
2638 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2640 const int *vals=self->getConstPointer();
2641 return convertIntArrToPyList(vals,self->getNbOfElems());
2645 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2647 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2651 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2654 bool ret0=self->isEqualIfNotWhy(other,ret1);
2655 PyObject *ret=PyTuple_New(2);
2656 PyObject *ret0Py=ret0?Py_True:Py_False;
2658 PyTuple_SetItem(ret,0,ret0Py);
2659 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2663 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2665 const int *vals=self->getConstPointer();
2666 int nbOfComp=self->getNumberOfComponents();
2667 int nbOfTuples=self->getNumberOfTuples();
2668 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2671 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2673 std::vector<const DataArrayInt *> groups;
2674 std::vector< std::vector<int> > fidsOfGroups;
2675 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2676 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2677 PyObject *ret = PyList_New(2);
2678 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2679 int sz=fidsOfGroups.size();
2680 PyObject *ret1 = PyList_New(sz);
2681 for(int i=0;i<sz;i++)
2682 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2683 PyList_SetItem(ret,1,ret1);
2687 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2690 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
2691 if (!SWIG_IsOK(res1))
2693 int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
2696 MapII *m=reinterpret_cast<MapII *>(da);
2697 self->transformWithIndArr(*m);
2702 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2703 self->transformWithIndArr(tmp,tmp+size);
2708 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2709 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2713 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2717 std::vector<int> multiVal;
2718 std::pair<int, std::pair<int,int> > slic;
2719 MEDCoupling::DataArrayInt *daIntTyypp=0;
2720 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2724 return self->findIdsEqualList(&singleVal,&singleVal+1);
2726 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2728 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2730 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2734 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2738 std::vector<int> multiVal;
2739 std::pair<int, std::pair<int,int> > slic;
2740 MEDCoupling::DataArrayInt *daIntTyypp=0;
2741 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2745 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2747 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2749 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2751 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2755 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2757 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2759 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2760 if (!SWIG_IsOK(res1))
2763 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2764 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2768 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2770 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2771 da2->checkAllocated();
2772 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2774 PyObject *ret = PyList_New(3);
2775 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2776 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2777 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2781 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2784 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2785 if (!SWIG_IsOK(res1))
2788 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2789 return self->transformWithIndArrR(tmp,tmp+size);
2793 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2794 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2798 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2801 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2802 if (!SWIG_IsOK(res1))
2805 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2806 if(size!=self->getNumberOfTuples())
2808 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2810 return self->renumberAndReduce(tmp,newNbOfTuple);
2814 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2816 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2817 da2->checkAllocated();
2818 int size=self->getNumberOfTuples();
2819 if(size!=self->getNumberOfTuples())
2821 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2823 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2827 DataArrayInt *renumber(PyObject *li) 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->renumber(tmp);
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->renumber(da2->getConstPointer());
2856 DataArrayInt *renumberR(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->renumberR(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->renumberR(da2->getConstPointer());
2885 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2887 std::vector<int> tmp;
2888 convertPyToNewIntArr3(li,tmp);
2889 self->setSelectedComponents(a,tmp);
2892 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2894 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2895 std::size_t sz(retCpp.size());
2896 PyObject *res(PyList_New(sz));
2897 for(std::size_t i=0;i<sz;i++)
2898 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2902 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2904 int sz=self->getNumberOfComponents();
2905 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2906 self->getTuple(tupleId,tmp);
2907 return convertIntArrToPyList(tmp,sz);
2910 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2912 DataArrayInt *arr=0;
2913 DataArrayInt *arrI=0;
2914 self->changeSurjectiveFormat(targetNb,arr,arrI);
2915 PyObject *res = PyList_New(2);
2916 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2917 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2921 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2923 std::vector<const DataArrayInt *> tmp;
2924 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2925 return DataArrayInt::Meld(tmp);
2928 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2930 std::vector<const DataArrayInt *> tmp;
2931 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2932 return DataArrayInt::Aggregate(tmp);
2935 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2937 std::vector<const DataArrayInt *> tmp;
2938 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2939 return DataArrayInt::AggregateIndexes(tmp);
2942 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2944 std::vector<const DataArrayInt *> tmp;
2945 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2946 return DataArrayInt::BuildUnion(tmp);
2949 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2951 std::vector<const DataArrayInt *> tmp;
2952 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2953 return DataArrayInt::BuildIntersection(tmp);
2956 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2959 int r1=self->getMaxValue(tmp);
2960 PyObject *ret=PyTuple_New(2);
2961 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2962 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2966 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2969 int r1=self->getMinValue(tmp);
2970 PyObject *ret=PyTuple_New(2);
2971 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2972 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2976 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2978 int nbOfCompo=self->getNumberOfComponents();
2983 if(PyInt_Check(obj))
2985 int val=(int)PyInt_AS_LONG(obj);
2986 return self->findIdFirstEqual(val);
2989 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
2993 std::vector<int> arr;
2994 convertPyToNewIntArr3(obj,arr);
2995 return self->findIdFirstEqualTuple(arr);
3000 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3002 int nbOfCompo=self->getNumberOfComponents();
3009 if(PyInt_Check(obj))
3011 int val=(int)PyInt_AS_LONG(obj);
3012 return self->presenceOfValue(val);
3015 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3019 std::vector<int> arr;
3020 convertPyToNewIntArr3(obj,arr);
3021 return self->presenceOfTuple(arr);
3026 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3028 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3029 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3030 self->checkAllocated();
3031 int nbOfTuples=self->getNumberOfTuples();
3032 int nbOfComponents=self->getNumberOfComponents();
3034 std::vector<int> vt1,vc1;
3035 std::pair<int, std::pair<int,int> > pt1,pc1;
3036 DataArrayInt *dt1=0,*dc1=0;
3038 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3039 MCAuto<DataArrayInt> ret;
3044 if(nbOfComponents==1)
3045 return PyInt_FromLong(self->getIJSafe(it1,0));
3046 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3049 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3051 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3053 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3055 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3058 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3059 std::vector<int> v2(1,ic1);
3060 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3064 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3065 std::vector<int> v2(1,ic1);
3066 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3070 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3071 std::vector<int> v2(1,ic1);
3072 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3076 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3077 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3081 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3082 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3086 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3087 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3091 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3092 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3096 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3097 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3098 std::vector<int> v2(nbOfComp);
3099 for(int i=0;i<nbOfComp;i++)
3100 v2[i]=pc1.first+i*pc1.second.second;
3101 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3105 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3106 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3107 std::vector<int> v2(nbOfComp);
3108 for(int i=0;i<nbOfComp;i++)
3109 v2[i]=pc1.first+i*pc1.second.second;
3110 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3114 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3115 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3116 std::vector<int> v2(nbOfComp);
3117 for(int i=0;i<nbOfComp;i++)
3118 v2[i]=pc1.first+i*pc1.second.second;
3119 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3123 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3124 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3125 std::vector<int> v2(nbOfComp);
3126 for(int i=0;i<nbOfComp;i++)
3127 v2[i]=pc1.first+i*pc1.second.second;
3128 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3131 throw INTERP_KERNEL::Exception(msg);
3135 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3137 self->checkAllocated();
3138 const char msg[]="Unexpected situation in __setitem__ !";
3139 int nbOfTuples=self->getNumberOfTuples();
3140 int nbOfComponents=self->getNumberOfComponents();
3143 std::vector<int> v1;
3145 DataArrayIntTuple *dd1=0;
3146 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3148 std::vector<int> vt1,vc1;
3149 std::pair<int, std::pair<int,int> > pt1,pc1;
3150 DataArrayInt *dt1=0,*dc1=0;
3151 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3152 MCAuto<DataArrayInt> tmp;
3160 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3163 tmp=DataArrayInt::New();
3164 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3165 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3168 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3171 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3172 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3175 throw INTERP_KERNEL::Exception(msg);
3184 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3187 tmp=DataArrayInt::New();
3188 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3189 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3192 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3195 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3196 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3199 throw INTERP_KERNEL::Exception(msg);
3208 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3211 tmp=DataArrayInt::New();
3212 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3213 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3216 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3219 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3220 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3223 throw INTERP_KERNEL::Exception(msg);
3232 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3235 tmp=DataArrayInt::New();
3236 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3237 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3240 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3243 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3244 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3247 throw INTERP_KERNEL::Exception(msg);
3256 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3259 tmp=DataArrayInt::New();
3260 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3261 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3264 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3267 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3268 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3271 throw INTERP_KERNEL::Exception(msg);
3280 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3283 tmp=DataArrayInt::New();
3284 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3285 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3288 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3291 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3292 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3295 throw INTERP_KERNEL::Exception(msg);
3304 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3307 tmp=DataArrayInt::New();
3308 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3309 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3312 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3315 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3316 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3319 throw INTERP_KERNEL::Exception(msg);
3328 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3331 tmp=DataArrayInt::New();
3332 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3333 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3336 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3339 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3340 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3343 throw INTERP_KERNEL::Exception(msg);
3352 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3355 tmp=DataArrayInt::New();
3356 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3357 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3360 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3363 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3364 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3367 throw INTERP_KERNEL::Exception(msg);
3376 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3379 tmp=DataArrayInt::New();
3380 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3381 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3384 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3387 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3388 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3391 throw INTERP_KERNEL::Exception(msg);
3400 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3403 tmp=DataArrayInt::New();
3404 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3405 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3408 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3411 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3412 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3415 throw INTERP_KERNEL::Exception(msg);
3424 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3427 tmp=DataArrayInt::New();
3428 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3429 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3432 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3435 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3436 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3439 throw INTERP_KERNEL::Exception(msg);
3448 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3451 tmp=DataArrayInt::New();
3452 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3453 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3456 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3459 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3460 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3463 throw INTERP_KERNEL::Exception(msg);
3472 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3475 tmp=DataArrayInt::New();
3476 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3477 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3480 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3483 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3484 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3487 throw INTERP_KERNEL::Exception(msg);
3496 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3499 tmp=DataArrayInt::New();
3500 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3501 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3504 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3507 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3508 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3511 throw INTERP_KERNEL::Exception(msg);
3520 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3523 tmp=DataArrayInt::New();
3524 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3525 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3528 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3531 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3532 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3535 throw INTERP_KERNEL::Exception(msg);
3540 throw INTERP_KERNEL::Exception(msg);
3545 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3547 return self->negate();
3550 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3552 const char msg[]="Unexpected situation in __add__ !";
3555 std::vector<int> aa;
3556 DataArrayIntTuple *aaa;
3558 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3563 MCAuto<DataArrayInt> ret=self->deepCopy();
3564 ret->applyLin(1,val);
3569 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3570 return DataArrayInt::Add(self,aaaa);
3574 return DataArrayInt::Add(self,a);
3578 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3579 return DataArrayInt::Add(self,aaaa);
3582 throw INTERP_KERNEL::Exception(msg);
3586 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3588 const char msg[]="Unexpected situation in __radd__ !";
3591 std::vector<int> aa;
3592 DataArrayIntTuple *aaa;
3594 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3599 MCAuto<DataArrayInt> ret=self->deepCopy();
3600 ret->applyLin(1,val);
3605 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3606 return DataArrayInt::Add(self,aaaa);
3610 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3611 return DataArrayInt::Add(self,aaaa);
3614 throw INTERP_KERNEL::Exception(msg);
3618 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3620 const char msg[]="Unexpected situation in __iadd__ !";
3623 std::vector<int> aa;
3624 DataArrayIntTuple *aaa;
3626 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3631 self->applyLin(1,val);
3632 Py_XINCREF(trueSelf);
3637 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3639 Py_XINCREF(trueSelf);
3645 Py_XINCREF(trueSelf);
3650 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3651 self->addEqual(aaaa);
3652 Py_XINCREF(trueSelf);
3656 throw INTERP_KERNEL::Exception(msg);
3660 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3662 const char msg[]="Unexpected situation in __sub__ !";
3665 std::vector<int> aa;
3666 DataArrayIntTuple *aaa;
3668 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3673 MCAuto<DataArrayInt> ret=self->deepCopy();
3674 ret->applyLin(1,-val);
3679 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3680 return DataArrayInt::Substract(self,aaaa);
3684 return DataArrayInt::Substract(self,a);
3688 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3689 return DataArrayInt::Substract(self,aaaa);
3692 throw INTERP_KERNEL::Exception(msg);
3696 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3698 const char msg[]="Unexpected situation in __rsub__ !";
3701 std::vector<int> aa;
3702 DataArrayIntTuple *aaa;
3704 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3709 MCAuto<DataArrayInt> ret=self->deepCopy();
3710 ret->applyLin(-1,val);
3715 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3716 return DataArrayInt::Substract(aaaa,self);
3720 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3721 return DataArrayInt::Substract(aaaa,self);
3724 throw INTERP_KERNEL::Exception(msg);
3728 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3730 const char msg[]="Unexpected situation in __isub__ !";
3733 std::vector<int> aa;
3734 DataArrayIntTuple *aaa;
3736 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3741 self->applyLin(1,-val);
3742 Py_XINCREF(trueSelf);
3747 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3748 self->substractEqual(bb);
3749 Py_XINCREF(trueSelf);
3754 self->substractEqual(a);
3755 Py_XINCREF(trueSelf);
3760 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3761 self->substractEqual(aaaa);
3762 Py_XINCREF(trueSelf);
3766 throw INTERP_KERNEL::Exception(msg);
3770 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3772 const char msg[]="Unexpected situation in __mul__ !";
3775 std::vector<int> aa;
3776 DataArrayIntTuple *aaa;
3778 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3783 MCAuto<DataArrayInt> ret=self->deepCopy();
3784 ret->applyLin(val,0);
3789 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3790 return DataArrayInt::Multiply(self,aaaa);
3794 return DataArrayInt::Multiply(self,a);
3798 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3799 return DataArrayInt::Multiply(self,aaaa);
3802 throw INTERP_KERNEL::Exception(msg);
3806 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3808 const char msg[]="Unexpected situation in __rmul__ !";
3811 std::vector<int> aa;
3812 DataArrayIntTuple *aaa;
3814 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3819 MCAuto<DataArrayInt> ret=self->deepCopy();
3820 ret->applyLin(val,0);
3825 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3826 return DataArrayInt::Multiply(self,aaaa);
3830 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3831 return DataArrayInt::Multiply(self,aaaa);
3834 throw INTERP_KERNEL::Exception(msg);
3838 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3840 const char msg[]="Unexpected situation in __imul__ !";
3843 std::vector<int> aa;
3844 DataArrayIntTuple *aaa;
3846 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3851 self->applyLin(val,0);
3852 Py_XINCREF(trueSelf);
3857 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3858 self->multiplyEqual(bb);
3859 Py_XINCREF(trueSelf);
3864 self->multiplyEqual(a);
3865 Py_XINCREF(trueSelf);
3870 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3871 self->multiplyEqual(aaaa);
3872 Py_XINCREF(trueSelf);
3876 throw INTERP_KERNEL::Exception(msg);
3880 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3882 const char msg[]="Unexpected situation in __div__ !";
3885 std::vector<int> aa;
3886 DataArrayIntTuple *aaa;
3888 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3893 MCAuto<DataArrayInt> ret=self->deepCopy();
3894 ret->applyDivideBy(val);
3899 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3900 return DataArrayInt::Divide(self,aaaa);
3904 return DataArrayInt::Divide(self,a);
3908 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3909 return DataArrayInt::Divide(self,aaaa);
3912 throw INTERP_KERNEL::Exception(msg);
3916 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3918 const char msg[]="Unexpected situation in __rdiv__ !";
3921 std::vector<int> aa;
3922 DataArrayIntTuple *aaa;
3924 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3929 MCAuto<DataArrayInt> ret=self->deepCopy();
3935 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3936 return DataArrayInt::Divide(aaaa,self);
3940 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3941 return DataArrayInt::Divide(aaaa,self);
3944 throw INTERP_KERNEL::Exception(msg);
3948 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3950 const char msg[]="Unexpected situation in __idiv__ !";
3953 std::vector<int> aa;
3954 DataArrayIntTuple *aaa;
3956 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3961 self->applyDivideBy(val);
3962 Py_XINCREF(trueSelf);
3967 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3968 self->divideEqual(bb);
3969 Py_XINCREF(trueSelf);
3974 self->divideEqual(a);
3975 Py_XINCREF(trueSelf);
3980 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3981 self->divideEqual(aaaa);
3982 Py_XINCREF(trueSelf);
3986 throw INTERP_KERNEL::Exception(msg);
3990 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3992 const char msg[]="Unexpected situation in __mod__ !";
3995 std::vector<int> aa;
3996 DataArrayIntTuple *aaa;
3998 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4003 MCAuto<DataArrayInt> ret=self->deepCopy();
4004 ret->applyModulus(val);
4009 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4010 return DataArrayInt::Modulus(self,aaaa);
4014 return DataArrayInt::Modulus(self,a);
4018 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4019 return DataArrayInt::Modulus(self,aaaa);
4022 throw INTERP_KERNEL::Exception(msg);
4026 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4028 const char msg[]="Unexpected situation in __rmod__ !";
4031 std::vector<int> aa;
4032 DataArrayIntTuple *aaa;
4034 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4039 MCAuto<DataArrayInt> ret=self->deepCopy();
4040 ret->applyRModulus(val);
4045 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4046 return DataArrayInt::Modulus(aaaa,self);
4050 return DataArrayInt::Modulus(a,self);
4054 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4055 return DataArrayInt::Modulus(aaaa,self);
4058 throw INTERP_KERNEL::Exception(msg);
4062 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4064 const char msg[]="Unexpected situation in __imod__ !";
4067 std::vector<int> aa;
4068 DataArrayIntTuple *aaa;
4070 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4075 self->applyModulus(val);
4076 Py_XINCREF(trueSelf);
4081 self->modulusEqual(a);
4082 Py_XINCREF(trueSelf);
4087 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4088 self->modulusEqual(aaaa);
4089 Py_XINCREF(trueSelf);
4093 throw INTERP_KERNEL::Exception(msg);
4097 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4099 const char msg[]="Unexpected situation in __pow__ !";
4102 std::vector<int> aa;
4103 DataArrayIntTuple *aaa;
4105 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4110 MCAuto<DataArrayInt> ret=self->deepCopy();
4116 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4117 return DataArrayInt::Pow(self,aaaa);
4121 return DataArrayInt::Pow(self,a);
4125 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4126 return DataArrayInt::Pow(self,aaaa);
4129 throw INTERP_KERNEL::Exception(msg);
4133 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4135 const char msg[]="Unexpected situation in __rpow__ !";
4138 std::vector<int> aa;
4139 DataArrayIntTuple *aaa;
4141 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4146 MCAuto<DataArrayInt> ret=self->deepCopy();
4147 ret->applyRPow(val);
4152 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4153 return DataArrayInt::Pow(aaaa,self);
4157 return DataArrayInt::Pow(a,self);
4161 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4162 return DataArrayInt::Pow(aaaa,self);
4165 throw INTERP_KERNEL::Exception(msg);
4169 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4171 const char msg[]="Unexpected situation in __ipow__ !";
4174 std::vector<int> aa;
4175 DataArrayIntTuple *aaa;
4177 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4182 self->applyPow(val);
4183 Py_XINCREF(trueSelf);
4189 Py_XINCREF(trueSelf);
4194 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4195 self->powEqual(aaaa);
4196 Py_XINCREF(trueSelf);
4200 throw INTERP_KERNEL::Exception(msg);
4204 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4206 std::ostringstream oss;
4207 self->reprQuickOverview(oss);
4211 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4213 int szArr,sw,iTypppArr;
4214 std::vector<int> stdvecTyyppArr;
4215 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4216 self->pushBackValsSilent(tmp,tmp+szArr);
4219 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4221 std::vector<int> ret1;
4222 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4223 std::size_t sz=ret0.size();
4224 PyObject *pyRet=PyTuple_New(2);
4225 PyObject *pyRet0=PyList_New((int)sz);
4226 PyObject *pyRet1=PyList_New((int)sz);
4227 for(std::size_t i=0;i<sz;i++)
4229 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4230 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4232 PyTuple_SetItem(pyRet,0,pyRet0);
4233 PyTuple_SetItem(pyRet,1,pyRet1);
4237 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4239 DataArrayInt *ret0=0,*ret1=0;
4240 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4241 PyObject *pyRet=PyTuple_New(2);
4242 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4243 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4247 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4250 bool ret(self->isRange(a,b,c));
4251 PyObject *pyRet=PyTuple_New(2);
4252 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4254 PyTuple_SetItem(pyRet,0,ret0Py);
4256 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4262 PyTuple_SetItem(pyRet,1,ret1Py);
4268 class DataArrayIntTuple;
4270 class DataArrayIntIterator
4273 DataArrayIntIterator(DataArrayInt *da);
4274 ~DataArrayIntIterator();
4279 DataArrayIntTuple *ret=self->nextt();
4281 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4284 PyErr_SetString(PyExc_StopIteration,"No more data.");
4291 class DataArrayIntTuple
4294 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4295 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4298 std::string __str__() const throw(INTERP_KERNEL::Exception)
4300 return self->repr();
4303 int __int__() const throw(INTERP_KERNEL::Exception)
4305 return self->intValue();
4308 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4310 return self->buildDAInt(1,self->getNumberOfCompo());
4313 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4315 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4316 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4317 Py_XINCREF(trueSelf);
4321 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4323 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4324 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4325 Py_XINCREF(trueSelf);
4329 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4331 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4332 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4333 Py_XINCREF(trueSelf);
4336 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4338 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4339 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4340 Py_XINCREF(trueSelf);
4344 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4346 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4347 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4348 Py_XINCREF(trueSelf);
4352 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4354 return PyInt_FromLong(self->getNumberOfCompo());
4357 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4359 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4362 std::vector<int> multiVal;
4363 std::pair<int, std::pair<int,int> > slic;
4364 MEDCoupling::DataArrayInt *daIntTyypp=0;
4365 const int *pt=self->getConstPointer();
4366 int nbc=self->getNumberOfCompo();
4367 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4374 std::ostringstream oss;
4375 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4376 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4380 return PyInt_FromLong(pt[singleVal]);
4384 return PyInt_FromLong(pt[nbc+singleVal]);
4387 std::ostringstream oss;
4388 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4389 throw INTERP_KERNEL::Exception(oss.str().c_str());
4395 PyObject *t=PyTuple_New(multiVal.size());
4396 for(int j=0;j<(int)multiVal.size();j++)
4398 int cid=multiVal[j];
4401 std::ostringstream oss;
4402 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4403 throw INTERP_KERNEL::Exception(oss.str().c_str());
4405 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4411 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4412 PyObject *t=PyTuple_New(sz);
4413 for(int j=0;j<sz;j++)
4414 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4418 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4422 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4424 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4425 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4428 std::vector<int> multiValV;
4429 std::pair<int, std::pair<int,int> > slicV;
4430 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4431 int nbc=self->getNumberOfCompo();
4432 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4434 std::vector<int> multiVal;
4435 std::pair<int, std::pair<int,int> > slic;
4436 MEDCoupling::DataArrayInt *daIntTyypp=0;
4437 int *pt=self->getPointer();
4438 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4445 std::ostringstream oss;
4446 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4447 throw INTERP_KERNEL::Exception(oss.str().c_str());
4453 pt[singleVal]=singleValV;
4458 if(multiValV.size()!=1)
4460 std::ostringstream oss;
4461 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4462 throw INTERP_KERNEL::Exception(oss.str().c_str());
4464 pt[singleVal]=multiValV[0];
4469 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4473 throw INTERP_KERNEL::Exception(msg);
4482 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4486 std::ostringstream oss;
4487 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4488 throw INTERP_KERNEL::Exception(oss.str().c_str());
4496 if(multiVal.size()!=multiValV.size())
4498 std::ostringstream oss;
4499 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4500 throw INTERP_KERNEL::Exception(oss.str().c_str());
4502 for(int i=0;i<(int)multiVal.size();i++)
4504 int pos=multiVal[i];
4507 std::ostringstream oss;
4508 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4509 throw INTERP_KERNEL::Exception(oss.str().c_str());
4511 pt[multiVal[i]]=multiValV[i];
4517 const int *ptV=daIntTyyppV->getConstPointer();
4518 if(nbc>daIntTyyppV->getNumberOfCompo())
4520 std::ostringstream oss;
4521 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4522 throw INTERP_KERNEL::Exception(oss.str().c_str());
4524 std::copy(ptV,ptV+nbc,pt);
4528 throw INTERP_KERNEL::Exception(msg);
4533 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4538 for(int j=0;j<sz;j++)
4539 pt[slic.first+j*slic.second.second]=singleValV;
4544 if(sz!=(int)multiValV.size())
4546 std::ostringstream oss;
4547 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4548 throw INTERP_KERNEL::Exception(oss.str().c_str());
4550 for(int j=0;j<sz;j++)
4551 pt[slic.first+j*slic.second.second]=multiValV[j];
4556 const int *ptV=daIntTyyppV->getConstPointer();
4557 if(sz>daIntTyyppV->getNumberOfCompo())
4559 std::ostringstream oss;
4560 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4561 throw INTERP_KERNEL::Exception(oss.str().c_str());
4563 for(int j=0;j<sz;j++)
4564 pt[slic.first+j*slic.second.second]=ptV[j];
4568 throw INTERP_KERNEL::Exception(msg);
4572 throw INTERP_KERNEL::Exception(msg);
4578 class DataArrayChar : public DataArray
4581 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4582 int getHashCode() const throw(INTERP_KERNEL::Exception);
4583 bool empty() const throw(INTERP_KERNEL::Exception);
4584 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4585 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4586 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4587 char popBackSilent() throw(INTERP_KERNEL::Exception);
4588 void pack() const throw(INTERP_KERNEL::Exception);
4589 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4590 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4591 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4592 void reverse() throw(INTERP_KERNEL::Exception);
4593 void fillWithZero() throw(INTERP_KERNEL::Exception);
4594 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4595 std::string repr() const throw(INTERP_KERNEL::Exception);
4596 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4597 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4598 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4599 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4600 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4601 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4602 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4603 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4604 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4605 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4606 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4607 char front() const throw(INTERP_KERNEL::Exception);
4608 char back() const throw(INTERP_KERNEL::Exception);
4609 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4610 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4611 char *getPointer() throw(INTERP_KERNEL::Exception);
4612 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4613 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4614 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4615 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4616 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4617 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4618 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4619 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4620 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4621 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4622 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4625 int __len__() const throw(INTERP_KERNEL::Exception)
4627 if(self->isAllocated())
4629 return self->getNumberOfTuples();
4633 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4637 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4640 bool ret0=self->isEqualIfNotWhy(other,ret1);
4641 PyObject *ret=PyTuple_New(2);
4642 PyObject *ret0Py=ret0?Py_True:Py_False;
4644 PyTuple_SetItem(ret,0,ret0Py);
4645 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4649 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4652 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4653 if (!SWIG_IsOK(res1))
4656 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4657 if(size!=self->getNumberOfTuples())
4659 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4661 return self->renumber(tmp);
4665 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4667 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4668 da2->checkAllocated();
4669 int size=self->getNumberOfTuples();
4670 if(size!=self->getNumberOfTuples())
4672 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4674 return self->renumber(da2->getConstPointer());
4678 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4681 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4682 if (!SWIG_IsOK(res1))
4685 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4686 if(size!=self->getNumberOfTuples())
4688 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4690 return self->renumberR(tmp);
4694 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4696 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4697 da2->checkAllocated();
4698 int size=self->getNumberOfTuples();
4699 if(size!=self->getNumberOfTuples())
4701 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4703 return self->renumberR(da2->getConstPointer());
4707 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4710 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4711 if (!SWIG_IsOK(res1))
4714 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4715 if(size!=self->getNumberOfTuples())
4717 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4719 return self->renumberAndReduce(tmp,newNbOfTuple);
4723 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4725 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4726 da2->checkAllocated();
4727 int size=self->getNumberOfTuples();
4728 if(size!=self->getNumberOfTuples())
4730 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4732 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4736 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4738 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4739 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4740 return DataArrayChar::Aggregate(tmp);
4743 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4745 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4746 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4747 return DataArrayChar::Meld(tmp);
4752 class DataArrayByteIterator;
4754 class DataArrayByte : public DataArrayChar
4757 static DataArrayByte *New();
4758 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4759 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4760 char byteValue() const throw(INTERP_KERNEL::Exception);
4763 DataArrayByte() throw(INTERP_KERNEL::Exception)
4765 return DataArrayByte::New();
4768 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4770 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) !";
4771 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4775 if(PyInt_Check(nbOfTuples))
4777 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4779 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4782 if(PyInt_Check(nbOfComp))
4783 {//DataArrayByte.New([1,3,4,5],2,2)
4784 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4786 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4787 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4788 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4789 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4793 throw INTERP_KERNEL::Exception(msg);
4796 {//DataArrayByte.New([1,3,4],3)
4797 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4799 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4800 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4805 throw INTERP_KERNEL::Exception(msg);
4808 {// DataArrayByte.New([1,3,4])
4809 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4810 int tmpp1=-1,tmpp2=-1;
4811 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4812 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4816 else if(PyInt_Check(elt0))
4818 int nbOfTuples1=PyInt_AS_LONG(elt0);
4820 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4825 if(PyInt_Check(nbOfTuples))
4826 {//DataArrayByte.New(5,2)
4827 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4829 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4830 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4831 ret->alloc(nbOfTuples1,nbOfCompo);
4835 throw INTERP_KERNEL::Exception(msg);
4838 throw INTERP_KERNEL::Exception(msg);
4841 {//DataArrayByte.New(5)
4842 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4843 ret->alloc(nbOfTuples1,1);
4848 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4849 {//DataArrayDouble.New(numpyArray)
4850 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4854 throw INTERP_KERNEL::Exception(msg);
4857 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4859 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4862 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4864 std::ostringstream oss;
4865 self->reprQuickOverview(oss);
4869 int __int__() const throw(INTERP_KERNEL::Exception)
4871 return (int) self->byteValue();
4874 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4876 return self->iterator();
4879 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4881 return (int)self->getIJ(tupleId,compoId);
4884 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4886 return (int)self->getIJSafe(tupleId,compoId);
4889 std::string __str__() const throw(INTERP_KERNEL::Exception)
4891 return self->repr();
4894 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4896 const char *vals=self->getConstPointer();
4897 int nbOfComp=self->getNumberOfComponents();
4898 int nbOfTuples=self->getNumberOfTuples();
4899 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4902 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4905 int ival=-1; std::vector<int> ivval;
4906 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4907 std::vector<char> vals(sz);
4908 std::copy(pt,pt+sz,vals.begin());
4909 return self->presenceOfTuple(vals);
4912 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4915 int ival=-1; std::vector<int> ivval;
4916 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4917 std::vector<char> vals2(sz);
4918 std::copy(pt,pt+sz,vals2.begin());
4919 return self->presenceOfValue(vals2);
4922 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4925 int ival=-1; std::vector<int> ivval;
4926 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4927 std::vector<char> vals2(sz);
4928 std::copy(pt,pt+sz,vals2.begin());
4929 return self->findIdFirstEqual(vals2);
4932 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4935 int ival=-1; std::vector<int> ivval;
4936 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4937 std::vector<char> vals(sz);
4938 std::copy(pt,pt+sz,vals.begin());
4939 return self->findIdFirstEqualTuple(vals);
4942 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4945 int ival=-1; std::vector<int> ivval;
4946 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
4947 std::vector<char> vals(sz);
4948 std::copy(pt,pt+sz,vals.begin());
4949 return self->findIdSequence(vals);
4952 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4954 int sz=self->getNumberOfComponents();
4955 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4956 self->getTuple(tupleId,tmp);
4957 PyObject *ret=PyTuple_New(sz);
4958 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4962 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4965 int r1=(int)self->getMaxValue(tmp);
4966 PyObject *ret=PyTuple_New(2);
4967 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4968 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4972 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4975 int r1=(int)self->getMinValue(tmp);
4976 PyObject *ret=PyTuple_New(2);
4977 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4978 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4982 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4984 int nbOfCompo=self->getNumberOfComponents();
4989 if(PyInt_Check(obj))
4991 int val=(int)PyInt_AS_LONG(obj);
4992 return self->findIdFirstEqual(val);
4995 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
4998 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5002 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5004 int nbOfCompo=self->getNumberOfComponents();
5011 if(PyInt_Check(obj))
5013 int val=(int)PyInt_AS_LONG(obj);
5014 return self->presenceOfValue(val);
5017 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5020 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5025 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5027 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5031 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5033 self->checkAllocated();
5034 const char msg[]="Unexpected situation in __setitem__ !";
5035 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5038 std::vector<int> v1;
5040 DataArrayIntTuple *dd1=0;
5041 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5043 std::vector<int> vt1,vc1;
5044 std::pair<int, std::pair<int,int> > pt1,pc1;
5045 DataArrayInt *dt1=0,*dc1=0;
5046 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5047 MCAuto<DataArrayInt> tmp;
5055 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5058 throw INTERP_KERNEL::Exception(msg);
5067 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5070 throw INTERP_KERNEL::Exception(msg);
5079 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5082 throw INTERP_KERNEL::Exception(msg);
5091 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5094 throw INTERP_KERNEL::Exception(msg);
5103 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5106 throw INTERP_KERNEL::Exception(msg);
5115 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5118 throw INTERP_KERNEL::Exception(msg);
5127 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5130 throw INTERP_KERNEL::Exception(msg);
5139 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5142 throw INTERP_KERNEL::Exception(msg);
5151 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5154 throw INTERP_KERNEL::Exception(msg);
5163 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5166 throw INTERP_KERNEL::Exception(msg);
5175 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5178 throw INTERP_KERNEL::Exception(msg);
5187 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5190 throw INTERP_KERNEL::Exception(msg);
5199 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5202 throw INTERP_KERNEL::Exception(msg);
5211 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5214 throw INTERP_KERNEL::Exception(msg);
5223 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5226 throw INTERP_KERNEL::Exception(msg);
5235 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5238 throw INTERP_KERNEL::Exception(msg);
5243 throw INTERP_KERNEL::Exception(msg);
5250 class DataArrayByteTuple;
5252 class DataArrayByteIterator
5255 DataArrayByteIterator(DataArrayByte *da);
5256 ~DataArrayByteIterator();
5259 class DataArrayByteTuple
5262 std::string repr() const throw(INTERP_KERNEL::Exception);
5263 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5266 std::string __str__() const throw(INTERP_KERNEL::Exception)
5268 return self->repr();
5271 char __int__() const throw(INTERP_KERNEL::Exception)
5273 return self->byteValue();
5276 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5278 return self->buildDAByte(1,self->getNumberOfCompo());
5283 class DataArrayAsciiCharIterator;
5285 class DataArrayAsciiChar : public DataArrayChar
5288 static DataArrayAsciiChar *New();
5289 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5290 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5291 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5294 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5296 return DataArrayAsciiChar::New();
5299 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5301 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) !";
5302 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5306 if(PyInt_Check(nbOfTuples))
5308 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5310 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5313 if(PyInt_Check(nbOfComp))
5314 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5315 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5317 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5318 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5319 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5320 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5324 throw INTERP_KERNEL::Exception(msg);
5327 {//DataArrayAsciiChar.New([1,3,4],3)
5328 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5330 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5331 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5335 else if(PyString_Check(nbOfTuples))
5337 if(PyString_Size(nbOfTuples)!=1)
5338 throw INTERP_KERNEL::Exception(msg);
5339 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5340 std::vector<std::string> tmp;
5341 if(fillStringVector(elt0,tmp))
5342 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5344 throw INTERP_KERNEL::Exception(msg);
5346 %#if PY_VERSION_HEX >= 0x03000000
5347 else if(PyUnicode_Check(nbOfTuples))
5349 if(PyUnicode_GET_LENGTH(nbOfTuples)!=1)
5350 throw INTERP_KERNEL::Exception(msg);
5351 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5352 std::vector<std::string> tmp;
5353 if(fillStringVector(elt0,tmp))
5354 return DataArrayAsciiChar::New(tmp,PyUnicode_AsUTF8(nbOfTuples)[0]);
5356 throw INTERP_KERNEL::Exception(msg);
5360 throw INTERP_KERNEL::Exception(msg);
5364 std::vector<std::string> tmmp;
5365 if(fillStringVector(elt0,tmmp))
5366 //DataArrayAsciiChar.New(["abc","de","fghi"])
5367 return DataArrayAsciiChar::New(tmmp,' ');
5370 // DataArrayAsciiChar.New([1,3,4])
5371 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5372 int tmpp1=-1,tmpp2=-1;
5373 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5374 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5379 else if(PyInt_Check(elt0))
5381 int nbOfTuples1=PyInt_AS_LONG(elt0);
5383 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5388 if(PyInt_Check(nbOfTuples))
5389 {//DataArrayAsciiChar.New(5,2)
5390 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5392 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5393 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5394 ret->alloc(nbOfTuples1,nbOfCompo);
5398 throw INTERP_KERNEL::Exception(msg);
5401 throw INTERP_KERNEL::Exception(msg);
5404 {//DataArrayAsciiChar.New(5)
5405 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5406 ret->alloc(nbOfTuples1,1);
5411 throw INTERP_KERNEL::Exception(msg);
5414 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5416 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5419 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5421 std::ostringstream oss;
5422 self->reprQuickOverview(oss);
5426 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5428 return self->iterator();
5431 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5433 char tmp[2]; tmp[1]='\0';
5434 tmp[0]=self->getIJ(tupleId,compoId);
5435 return std::string(tmp);
5438 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5440 char tmp[2]; tmp[1]='\0';
5441 tmp[0]=self->getIJSafe(tupleId,compoId);
5442 return std::string(tmp);
5445 std::string __str__() const throw(INTERP_KERNEL::Exception)
5447 return self->repr();
5450 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5452 const char *vals=self->getConstPointer();
5453 int nbOfComp=self->getNumberOfComponents();
5454 int nbOfTuples=self->getNumberOfTuples();
5455 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5458 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5460 if(PyString_Check(tupl))
5462 Py_ssize_t sz=PyString_Size(tupl);
5463 std::vector<char> vals(sz);
5464 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5465 return self->presenceOfTuple(vals);
5467 %#if PY_VERSION_HEX >= 0x03000000
5468 else if(PyUnicode_Check(tupl))
5470 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5471 std::vector<char> vals(sz);
5472 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5473 return self->presenceOfTuple(vals);
5477 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5480 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5482 if(PyString_Check(vals))
5484 Py_ssize_t sz=PyString_Size(vals);
5485 std::vector<char> vals2(sz);
5486 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5487 return self->presenceOfValue(vals2);
5489 %#if PY_VERSION_HEX >= 0x03000000
5490 if(PyUnicode_Check(vals))
5492 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5493 std::vector<char> vals2(sz);
5494 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5495 return self->presenceOfValue(vals2);
5499 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5502 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5504 if(PyString_Check(vals))
5506 Py_ssize_t sz=PyString_Size(vals);
5507 std::vector<char> vals2(sz);
5508 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5509 return self->findIdFirstEqual(vals2);
5511 %#if PY_VERSION_HEX >= 0x03000000
5512 if(PyUnicode_Check(vals))
5514 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5515 std::vector<char> vals2(sz);
5516 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5517 return self->findIdFirstEqual(vals2);
5521 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5524 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5526 if(PyString_Check(tupl))
5528 Py_ssize_t sz=PyString_Size(tupl);
5529 std::vector<char> vals(sz);
5530 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5531 return self->findIdFirstEqualTuple(vals);
5533 %#if PY_VERSION_HEX >= 0x03000000
5534 if(PyUnicode_Check(tupl))
5536 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5537 std::vector<char> vals(sz);
5538 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5539 return self->findIdFirstEqualTuple(vals);
5543 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5546 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5548 if(PyString_Check(strOrListOfInt))
5550 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5551 std::vector<char> vals(sz);
5552 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5553 return self->findIdSequence(vals);
5555 %#if PY_VERSION_HEX >= 0x03000000
5556 else if(PyUnicode_Check(strOrListOfInt))
5558 Py_ssize_t sz=PyUnicode_GET_LENGTH(strOrListOfInt);
5559 std::vector<char> vals(sz);
5560 std::copy(PyUnicode_AsUTF8(strOrListOfInt),PyUnicode_AsUTF8(strOrListOfInt)+sz,vals.begin());
5561 return self->findIdSequence(vals);
5565 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5568 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5570 int sz=self->getNumberOfComponents();
5571 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5572 self->getTuple(tupleId,tmp);
5573 return PyString_FromString(tmp);
5576 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5579 char tmp2[2]; tmp2[1]='\0';
5580 tmp2[0]=self->getMaxValue(tmp);
5581 PyObject *ret=PyTuple_New(2);
5582 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5583 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5587 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5590 char tmp2[2]; tmp2[1]='\0';
5591 tmp2[0]=self->getMinValue(tmp);
5592 PyObject *ret=PyTuple_New(2);
5593 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5594 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5598 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5600 int nbOfCompo=self->getNumberOfComponents();
5605 if(PyString_Check(obj))
5607 Py_ssize_t sz=PyString_Size(obj);
5608 char *pt=PyString_AsString(obj);
5610 return self->findIdFirstEqual(pt[0]);
5612 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5614 %#if PY_VERSION_HEX >= 0x03000000
5615 if(PyUnicode_Check(obj))
5618 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
5620 return self->findIdFirstEqual(pt[0]);
5622 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5626 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5629 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5633 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5635 int nbOfCompo=self->getNumberOfComponents();
5642 if(PyString_Check(obj))
5644 Py_ssize_t sz=PyString_Size(obj);
5645 char *pt=PyString_AsString(obj);
5647 return self->presenceOfValue(pt[0]);
5649 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5651 %#if PY_VERSION_HEX >= 0x03000000
5652 if(PyUnicode_Check(obj))
5655 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
5657 return self->presenceOfValue(pt[0]);
5659 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());
5896 def MEDCouplingStdReduceFunct(cls,params):
5898 ret=object.__new__(cls)
5903 def MEDCouplingDataArrayDoubleReduce(self):
5904 if not MEDCouplingHasNumPyBindings():
5905 raise InterpKernelException("PyWrap of DataArrayDouble.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5906 return MEDCouplingStdReduceFunct,(DataArrayDouble,((self.toNumPyArray(),),(self.__getstate__()),))
5908 def MEDCouplingDataArrayIntReduce(self):
5909 if not MEDCouplingHasNumPyBindings():
5910 raise InterpKernelException("PyWrap of DataArrayInt.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5911 return MEDCouplingStdReduceFunct,(DataArrayInt,((self.toNumPyArray(),),(self.__getstate__()),))
5913 def MEDCouplingDataArrayByteReduce(self):
5914 if not MEDCouplingHasNumPyBindings():
5915 raise InterpKernelException("PyWrap of DataArrayByte.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5916 return MEDCouplingStdReduceFunct,(DataArrayByte,((self.toNumPyArray(),),(self.__getstate__()),))
5918 def MEDCouplingDataArrayFloatReduce(self):
5919 if not MEDCouplingHasNumPyBindings():
5920 raise InterpKernelException("PyWrap of DataArrayFloat.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5921 return MEDCouplingStdReduceFunct,(DataArrayFloat,((self.toNumPyArray(),),(self.__getstate__()),))