1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
22 %typemap(out) MEDCoupling::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) MEDCoupling::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
44 %typemap(out) MCAuto<MEDCoupling::DataArrayInt>
46 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN|0);
49 %typemap(out) MCAuto<MEDCoupling::DataArrayDouble>
51 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN|0);
54 %typemap(out) MCAuto<MEDCoupling::DataArrayFloat>
56 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayFloat,SWIG_POINTER_OWN|0);
60 %newobject MEDCoupling::DataArray::deepCopy;
61 %newobject MEDCoupling::DataArray::buildNewEmptyInstance;
62 %newobject MEDCoupling::DataArray::selectByTupleRanges;
63 %newobject MEDCoupling::DataArray::selectByTupleId;
64 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
65 %newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
66 %newobject MEDCoupling::DataArray::Aggregate;
67 %newobject MEDCoupling::DataArrayFloat::New;
68 %newobject MEDCoupling::DataArrayFloat::iterator;
69 %newobject MEDCoupling::DataArrayFloat::__iter__;
70 %newobject MEDCoupling::DataArrayInt::New;
71 %newobject MEDCoupling::DataArrayInt::__iter__;
72 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
73 %newobject MEDCoupling::DataArrayInt::subArray;
74 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
75 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
76 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
77 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
78 %newobject MEDCoupling::DataArrayInt::renumber;
79 %newobject MEDCoupling::DataArrayInt::renumberR;
80 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
81 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
82 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
83 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
84 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
85 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
86 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
87 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
88 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
89 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
90 %newobject MEDCoupling::DataArrayInt::negate;
91 %newobject MEDCoupling::DataArrayInt::computeAbs;
92 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
93 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
94 %newobject MEDCoupling::DataArrayInt::findIdsStrictlyNegative;
95 %newobject MEDCoupling::DataArrayInt::Aggregate;
96 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
97 %newobject MEDCoupling::DataArrayInt::Meld;
98 %newobject MEDCoupling::DataArrayInt::Add;
99 %newobject MEDCoupling::DataArrayInt::Substract;
100 %newobject MEDCoupling::DataArrayInt::Multiply;
101 %newobject MEDCoupling::DataArrayInt::Divide;
102 %newobject MEDCoupling::DataArrayInt::Pow;
103 %newobject MEDCoupling::DataArrayInt::BuildUnion;
104 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
105 %newobject MEDCoupling::DataArrayInt::Range;
106 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
107 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
108 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
109 %newobject MEDCoupling::DataArrayInt::buildComplement;
110 %newobject MEDCoupling::DataArrayInt::buildUnion;
111 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
112 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
113 %newobject MEDCoupling::DataArrayInt::buildIntersection;
114 %newobject MEDCoupling::DataArrayInt::buildUnique;
115 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
116 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
117 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
118 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
119 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
120 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
121 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
122 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
123 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
124 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
125 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
126 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
127 %newobject MEDCoupling::DataArrayInt::__neg__;
128 %newobject MEDCoupling::DataArrayInt::__add__;
129 %newobject MEDCoupling::DataArrayInt::__radd__;
130 %newobject MEDCoupling::DataArrayInt::__sub__;
131 %newobject MEDCoupling::DataArrayInt::__rsub__;
132 %newobject MEDCoupling::DataArrayInt::__mul__;
133 %newobject MEDCoupling::DataArrayInt::__rmul__;
134 %newobject MEDCoupling::DataArrayInt::__div__;
135 %newobject MEDCoupling::DataArrayInt::__rdiv__;
136 %newobject MEDCoupling::DataArrayInt::__mod__;
137 %newobject MEDCoupling::DataArrayInt::__rmod__;
138 %newobject MEDCoupling::DataArrayInt::__pow__;
139 %newobject MEDCoupling::DataArrayInt::__rpow__;
140 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
141 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
142 %newobject MEDCoupling::DataArrayChar::renumber;
143 %newobject MEDCoupling::DataArrayChar::renumberR;
144 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
145 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
146 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
147 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
148 %newobject MEDCoupling::DataArrayChar::Aggregate;
149 %newobject MEDCoupling::DataArrayChar::Meld;
150 %newobject MEDCoupling::DataArrayByte::New;
151 %newobject MEDCoupling::DataArrayByte::__iter__;
152 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
153 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
154 %newobject MEDCoupling::DataArrayChar::subArray;
155 %newobject MEDCoupling::DataArrayAsciiChar::New;
156 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
157 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
158 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
159 %newobject MEDCoupling::DataArrayDouble::New;
160 %newobject MEDCoupling::DataArrayDouble::__iter__;
161 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
162 %newobject MEDCoupling::DataArrayDouble::Aggregate;
163 %newobject MEDCoupling::DataArrayDouble::Meld;
164 %newobject MEDCoupling::DataArrayDouble::Dot;
165 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
166 %newobject MEDCoupling::DataArrayDouble::Add;
167 %newobject MEDCoupling::DataArrayDouble::Substract;
168 %newobject MEDCoupling::DataArrayDouble::Multiply;
169 %newobject MEDCoupling::DataArrayDouble::Divide;
170 %newobject MEDCoupling::DataArrayDouble::Pow;
171 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
172 %newobject MEDCoupling::DataArrayDouble::subArray;
173 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
174 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
175 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
176 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
177 %newobject MEDCoupling::DataArrayDouble::findIdsStrictlyNegative;
178 %newobject MEDCoupling::DataArrayDouble::negate;
179 %newobject MEDCoupling::DataArrayDouble::computeAbs;
180 %newobject MEDCoupling::DataArrayDouble::applyFunc;
181 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
182 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
183 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
184 %newobject MEDCoupling::DataArrayDouble::determinant;
185 %newobject MEDCoupling::DataArrayDouble::eigenValues;
186 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
187 %newobject MEDCoupling::DataArrayDouble::inverse;
188 %newobject MEDCoupling::DataArrayDouble::trace;
189 %newobject MEDCoupling::DataArrayDouble::deviator;
190 %newobject MEDCoupling::DataArrayDouble::magnitude;
191 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
192 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
193 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
194 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
195 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
196 %newobject MEDCoupling::DataArrayDouble::renumber;
197 %newobject MEDCoupling::DataArrayDouble::renumberR;
198 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
199 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
200 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
201 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
202 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
203 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
204 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
205 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
206 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
207 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
208 %newobject MEDCoupling::DataArrayDouble::cartesianize;
209 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
210 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
211 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
212 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
213 %newobject MEDCoupling::DataArrayDouble::__neg__;
214 %newobject MEDCoupling::DataArrayDouble::__radd__;
215 %newobject MEDCoupling::DataArrayDouble::__rsub__;
216 %newobject MEDCoupling::DataArrayDouble::__rmul__;
217 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
218 %newobject MEDCoupling::DataArrayDouble::__pow__;
219 %newobject MEDCoupling::DataArrayDouble::__rpow__;
220 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
222 %newobject MEDCoupling::PartDefinition::New;
223 %newobject MEDCoupling::PartDefinition::toDAI;
224 %newobject MEDCoupling::PartDefinition::__add__;
225 %newobject MEDCoupling::PartDefinition::composeWith;
226 %newobject MEDCoupling::PartDefinition::tryToSimplify;
227 %newobject MEDCoupling::DataArrayPartDefinition::New;
228 %newobject MEDCoupling::SlicePartDefinition::New;
231 %feature("unref") DataArray "$this->decrRef();"
232 %feature("unref") DataArrayDouble "$this->decrRef();"
233 %feature("unref") DataArrayInt "$this->decrRef();"
234 %feature("unref") DataArrayChar "$this->decrRef();"
235 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
236 %feature("unref") DataArrayByte "$this->decrRef();"
238 %feature("unref") PartDefinition "$this->decrRef();"
239 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
240 %feature("unref") SlicePartDefinition "$this->decrRef();"
242 namespace MEDCoupling
249 } MEDCouplingAxisType;
253 class PartDefinition : public RefCountObject, public TimeLabel
256 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
257 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
258 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
259 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
260 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
261 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
262 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
263 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
266 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
268 return (*self)+other;
271 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
274 bool ret0(self->isEqual(other,ret1));
275 PyObject *ret=PyTuple_New(2);
276 PyObject *ret0Py=ret0?Py_True:Py_False;
278 PyTuple_SetItem(ret,0,ret0Py);
279 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
283 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
285 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
289 virtual ~PartDefinition();
292 class DataArrayPartDefinition : public PartDefinition
295 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
298 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
300 return DataArrayPartDefinition::New(listOfIds);
303 std::string __str__() const throw(INTERP_KERNEL::Exception)
305 return self->getRepr();
308 std::string __repr__() const throw(INTERP_KERNEL::Exception)
310 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
311 oss << self->getRepr();
316 virtual ~DataArrayPartDefinition();
319 class SlicePartDefinition : public PartDefinition
322 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
323 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
326 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
328 return SlicePartDefinition::New(start,stop,step);
331 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
334 self->getSlice(a,b,c);
335 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
338 std::string __str__() const throw(INTERP_KERNEL::Exception)
340 return self->getRepr();
343 std::string __repr__() const throw(INTERP_KERNEL::Exception)
345 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
346 oss << self->getRepr();
351 virtual ~SlicePartDefinition();
354 class DataArray : public RefCountObject, public TimeLabel
357 void setName(const std::string& name);
358 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
359 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
360 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
361 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
362 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
363 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
364 std::string getName() const;
365 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
366 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
367 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
368 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
369 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
370 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
371 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
372 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
373 int getNumberOfComponents() const;
374 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
375 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
376 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
377 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
378 virtual void desallocate() throw(INTERP_KERNEL::Exception);
379 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
380 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
381 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
382 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
383 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
384 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
385 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
386 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
387 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
388 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
389 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
390 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
391 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
392 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
393 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
394 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
395 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
396 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
397 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
398 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
399 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
400 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
401 void updateTime() const;
404 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
406 const std::vector<std::string>& comps=self->getInfoOnComponents();
407 PyObject *ret=PyList_New((int)comps.size());
408 for(int i=0;i<(int)comps.size();i++)
409 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
413 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
415 std::vector<int> tmp;
416 convertPyToNewIntArr3(li,tmp);
417 self->copyPartOfStringInfoFrom(other,tmp);
420 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
422 std::vector<int> tmp;
423 convertPyToNewIntArr3(li,tmp);
424 self->copyPartOfStringInfoFrom2(tmp,other);
427 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
430 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
431 if (!SWIG_IsOK(res1))
434 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
435 if(size!=self->getNumberOfTuples())
437 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
439 self->renumberInPlace(tmp);
443 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
445 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
446 da2->checkAllocated();
447 int size=self->getNumberOfTuples();
448 if(size!=self->getNumberOfTuples())
450 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
452 self->renumberInPlace(da2->getConstPointer());
456 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
459 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
460 if (!SWIG_IsOK(res1))
463 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
464 if(size!=self->getNumberOfTuples())
466 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
468 self->renumberInPlaceR(tmp);
472 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
474 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
475 da2->checkAllocated();
476 int size=self->getNumberOfTuples();
477 if(size!=self->getNumberOfTuples())
479 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
481 self->renumberInPlaceR(da2->getConstPointer());
485 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
486 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
488 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
489 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
490 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
491 DataArrayInt *tuplesSelecPtr2=0;
494 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
496 throw INTERP_KERNEL::Exception(msg);
498 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
501 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
503 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
504 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
507 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
509 std::vector<std::pair<int,int> > ranges;
510 convertPyToVectorPairInt(li,ranges);
511 return self->selectByTupleRanges(ranges);
514 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
517 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
518 if (!SWIG_IsOK(res1))
521 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
522 return self->selectByTupleId(tmp,tmp+size);
526 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
528 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
529 da2->checkAllocated();
530 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
534 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
537 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
538 if (!SWIG_IsOK(res1))
541 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
542 return self->selectByTupleIdSafe(tmp,tmp+size);
546 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
548 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
549 da2->checkAllocated();
550 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
554 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
556 std::vector<int> tmp;
557 convertPyToNewIntArr3(li,tmp);
558 DataArray *ret=self->keepSelectedComponents(tmp);
559 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
562 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
564 if(!PySlice_Check(slic))
565 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
566 Py_ssize_t strt=2,stp=2,step=2;
567 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
568 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
570 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
571 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
574 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
576 if(!PySlice_Check(slic))
577 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
578 Py_ssize_t strt=2,stp=2,step=2;
579 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
580 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
582 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
583 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
586 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
588 if(!PySlice_Check(slic))
589 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
590 Py_ssize_t strt=2,stp=2,step=2;
591 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
592 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
593 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
596 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
598 if(!PySlice_Check(slic))
599 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
600 Py_ssize_t strt=2,stp=2,step=2;
601 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
602 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
603 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
606 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
608 std::vector<const DataArray *> tmp;
609 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
610 return DataArray::Aggregate(tmp);
613 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
615 if(!PySlice_Check(slic))
616 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
617 Py_ssize_t strt=2,stp=2,step=2;
618 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
619 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
620 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
623 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
625 if(!PySlice_Check(slic))
626 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
627 Py_ssize_t strt=2,stp=2,step=2;
628 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
629 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
630 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
633 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
635 PyObject *ret(PyTuple_New(2));
636 std::string a0(self->getName());
637 const std::vector<std::string> &a1(self->getInfoOnComponents());
638 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
641 PyObject *ret1(PyList_New(sz));
642 for(int i=0;i<sz;i++)
643 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
644 PyTuple_SetItem(ret,1,ret1);
649 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
651 static const char MSG[]="DataArrayDouble.__setstate__ : expected input is a tuple of size 2 with string as 1st arg and list of string as 2nd arg !";
652 if(!PyTuple_Check(inp))
653 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
654 int sz(PyTuple_Size(inp));
656 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
657 PyObject *a0(PyTuple_GetItem(inp,0));
658 if(!PyString_Check(a0))
659 throw INTERP_KERNEL::Exception(MSG);
660 PyObject *a1(PyTuple_GetItem(inp,1));
661 std::vector<std::string> a1cpp;
662 if(!fillStringVector(a1,a1cpp))
663 throw INTERP_KERNEL::Exception(MSG);
664 self->setName(PyString_AsString(a0));
665 self->setInfoOnComponents(a1cpp);
670 class DataArrayDouble;
672 class DataArrayFloat : public DataArray
675 static DataArrayFloat *New();
676 void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
677 bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
678 bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
679 bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
680 void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
681 void iota(float init=0.) throw(INTERP_KERNEL::Exception);
682 DataArrayFloatIterator *iterator() throw(INTERP_KERNEL::Exception);
683 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
686 DataArrayFloat() throw(INTERP_KERNEL::Exception)
688 return DataArrayFloat::New();
691 static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
693 return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
696 DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
698 return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
701 DataArrayFloatIterator *__iter__() throw(INTERP_KERNEL::Exception)
703 return self->iterator();
706 std::string __repr__() const throw(INTERP_KERNEL::Exception)
708 std::ostringstream oss;
709 self->reprQuickOverview(oss);
713 std::string __str__() const throw(INTERP_KERNEL::Exception)
715 return self->reprNotTooLong();
718 int __len__() const throw(INTERP_KERNEL::Exception)
720 if(self->isAllocated())
722 return self->getNumberOfTuples();
726 throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
730 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
732 const float *vals(self->begin());
733 return convertDblArrToPyList<float>(vals,self->getNbOfElems());
736 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
738 const float *vals(self->begin());
739 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
740 return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
743 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
745 return DataArrayT__getitem<float>(self,obj);
748 DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
750 return DataArrayT__setitem__<float>(self,obj,value);
753 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
755 return DataArrayT_iadd<float>(trueSelf,obj,self);
758 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
760 return DataArrayT_isub<float>(trueSelf,obj,self);
763 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
765 return DataArrayT_imul<float>(trueSelf,obj,self);
768 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
770 return DataArrayT_idiv<float>(trueSelf,obj,self);
774 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
776 return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
783 class DataArrayFloatTuple;
785 class DataArrayFloatIterator
788 DataArrayFloatIterator(DataArrayFloat *da);
789 ~DataArrayFloatIterator();
794 DataArrayFloatTuple *ret=self->nextt();
796 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple,SWIG_POINTER_OWN|0);
799 PyErr_SetString(PyExc_StopIteration,"No more data.");
806 class DataArrayFloatTuple
809 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
810 DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
813 std::string __str__() const throw(INTERP_KERNEL::Exception)
818 float __float__() const throw(INTERP_KERNEL::Exception)
820 return self->floatValue();
823 DataArrayFloat *buildDAFloat() throw(INTERP_KERNEL::Exception)
825 return self->buildDAFloat(1,self->getNumberOfCompo());
828 /*PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
830 MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
831 MEDCoupling_DataArrayFloat____imul___(ret,0,obj);
832 Py_XINCREF(trueSelf);
836 PyObject *__len__() throw(INTERP_KERNEL::Exception)
838 return PyInt_FromLong(self->getNumberOfCompo());
844 class DataArrayDoubleIterator;
846 class DataArrayDouble : public DataArray
849 static DataArrayDouble *New();
850 double doubleValue() const throw(INTERP_KERNEL::Exception);
851 bool empty() const throw(INTERP_KERNEL::Exception);
852 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
853 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
854 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
855 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
856 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
857 double popBackSilent() throw(INTERP_KERNEL::Exception);
858 void pack() const throw(INTERP_KERNEL::Exception);
859 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
860 void fillWithZero() throw(INTERP_KERNEL::Exception);
861 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
862 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
863 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
864 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
865 void reverse() throw(INTERP_KERNEL::Exception);
866 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
867 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
868 std::string repr() const throw(INTERP_KERNEL::Exception);
869 std::string reprZip() const throw(INTERP_KERNEL::Exception);
870 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
871 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
872 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
873 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
874 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
875 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
876 void transpose() throw(INTERP_KERNEL::Exception);
877 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
878 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
879 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
880 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
881 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
882 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
883 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
884 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
885 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
886 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
887 double front() const throw(INTERP_KERNEL::Exception);
888 double back() const throw(INTERP_KERNEL::Exception);
889 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
890 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
891 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
892 double *getPointer() throw(INTERP_KERNEL::Exception);
893 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
894 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
895 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
896 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
897 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
898 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
899 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
900 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
901 double getAverageValue() const throw(INTERP_KERNEL::Exception);
902 double norm2() const throw(INTERP_KERNEL::Exception);
903 double normMax() const throw(INTERP_KERNEL::Exception);
904 double normMin() const throw(INTERP_KERNEL::Exception);
905 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
906 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
907 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
908 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
909 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
910 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
911 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
912 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
913 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
914 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
915 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
916 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
917 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
918 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
919 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
920 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
921 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
922 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
923 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
924 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
925 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
926 void abs() throw(INTERP_KERNEL::Exception);
927 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
928 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
929 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
930 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
931 void applyPow(double val) throw(INTERP_KERNEL::Exception);
932 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
933 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
934 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
935 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
936 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
937 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
938 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
939 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
940 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
941 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
942 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
943 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
944 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
945 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
946 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
947 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
948 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
949 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
950 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
951 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
952 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
953 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
954 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
955 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
956 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
957 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
958 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
959 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
960 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
961 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
962 MCAuto<DataArrayInt> findIdsGreaterThan(double val) const throw(INTERP_KERNEL::Exception);
963 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
964 MCAuto<DataArrayInt> findIdsLowerThan(double val) const throw(INTERP_KERNEL::Exception);
965 MCAuto<DataArrayInt> convertToIntArr() const throw(INTERP_KERNEL::Exception);
966 MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
967 MCAuto<DataArrayDouble> cumSum() const throw(INTERP_KERNEL::Exception);
968 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
971 DataArrayDouble() throw(INTERP_KERNEL::Exception)
973 return DataArrayDouble::New();
976 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
978 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
981 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
983 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
986 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
989 std::vector<double> bb;
991 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
992 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
993 self->pushBackValsSilent(tmp,tmp+nbTuples);
996 std::string __repr__() const throw(INTERP_KERNEL::Exception)
998 std::ostringstream oss;
999 self->reprQuickOverview(oss);
1003 std::string __str__() const throw(INTERP_KERNEL::Exception)
1005 return self->reprNotTooLong();
1008 double __float__() const throw(INTERP_KERNEL::Exception)
1010 return self->doubleValue();
1013 int __len__() const throw(INTERP_KERNEL::Exception)
1015 if(self->isAllocated())
1017 return self->getNumberOfTuples();
1021 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
1025 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
1027 return self->iterator();
1030 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1032 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 !";
1033 if(PyList_Check(li) || PyTuple_Check(li))
1037 if(PyInt_Check(nbOfTuples))
1039 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1041 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
1044 if(PyInt_Check(nbOfComp))
1045 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
1046 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1048 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
1049 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
1050 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1053 throw INTERP_KERNEL::Exception(msg);
1056 {//DataArrayDouble.setValues([1.,3.,4.],3)
1058 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
1059 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1063 throw INTERP_KERNEL::Exception(msg);
1066 {// DataArrayDouble.setValues([1.,3.,4.])
1067 int tmpp1=-1,tmpp2=-1;
1068 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
1069 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1073 throw INTERP_KERNEL::Exception(msg);
1076 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
1078 const double *vals(self->begin());
1079 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
1083 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
1085 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1089 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1092 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1093 PyObject *ret=PyTuple_New(2);
1094 PyObject *ret0Py=ret0?Py_True:Py_False;
1096 PyTuple_SetItem(ret,0,ret0Py);
1097 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1101 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1103 const double *vals(self->begin());
1104 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1105 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1108 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1110 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1112 DataArrayDouble *a,*a2;
1113 DataArrayDoubleTuple *aa,*aa2;
1114 std::vector<double> bb,bb2;
1116 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1117 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1118 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1122 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1124 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1126 DataArrayDouble *a,*a2;
1127 DataArrayDoubleTuple *aa,*aa2;
1128 std::vector<double> bb,bb2;
1130 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1132 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1133 return convertDblArrToPyListOfTuple<double>(res,3,3);
1136 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1138 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1140 DataArrayDouble *a,*a2;
1141 DataArrayDoubleTuple *aa,*aa2;
1142 std::vector<double> bb,bb2;
1144 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1145 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1146 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1149 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1152 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1153 if (!SWIG_IsOK(res1))
1156 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1157 if(size!=self->getNumberOfTuples())
1159 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1161 return self->renumber(tmp);
1165 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1167 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1168 da2->checkAllocated();
1169 int size=self->getNumberOfTuples();
1170 if(size!=self->getNumberOfTuples())
1172 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1174 return self->renumber(da2->getConstPointer());
1178 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1181 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1182 if (!SWIG_IsOK(res1))
1185 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1186 if(size!=self->getNumberOfTuples())
1188 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1190 return self->renumberR(tmp);
1194 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1196 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1197 da2->checkAllocated();
1198 int size=self->getNumberOfTuples();
1199 if(size!=self->getNumberOfTuples())
1201 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1203 return self->renumberR(da2->getConstPointer());
1207 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1210 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1211 if (!SWIG_IsOK(res1))
1214 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1215 if(size!=self->getNumberOfTuples())
1217 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1219 return self->renumberAndReduce(tmp,newNbOfTuple);
1223 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1225 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1226 da2->checkAllocated();
1227 int size=self->getNumberOfTuples();
1228 if(size!=self->getNumberOfTuples())
1230 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1232 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1236 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1238 int thisTupleId,otherTupleId;
1239 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1240 PyObject *ret=PyTuple_New(3);
1241 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1242 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1243 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1247 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1250 double r1=self->getMaxValue(tmp);
1251 PyObject *ret=PyTuple_New(2);
1252 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1253 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1257 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1260 double r1=self->getMaxValue2(tmp);
1261 PyObject *ret=PyTuple_New(2);
1262 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1263 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1267 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1270 double r1=self->getMinValue(tmp);
1271 PyObject *ret=PyTuple_New(2);
1272 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1273 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1277 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1280 double r1=self->getMinValue2(tmp);
1281 PyObject *ret=PyTuple_New(2);
1282 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1283 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1287 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1289 int nbOfCompo(self->getNumberOfComponents());
1290 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1291 self->getMinMaxPerComponent(tmp);
1292 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1296 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1298 int sz=self->getNumberOfComponents();
1299 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1300 self->accumulate(tmp);
1301 return convertDblArrToPyList<double>(tmp,sz);
1304 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1307 std::vector<int> val2;
1308 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1309 return self->accumulatePerChunck(bg,bg+sz);
1312 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1314 DataArrayInt *comm, *commIndex;
1315 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1316 PyObject *res = PyList_New(2);
1317 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1318 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1322 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1326 DataArrayDoubleTuple *aa;
1327 std::vector<double> bb;
1329 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1330 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1332 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1333 PyObject *ret=PyTuple_New(2);
1334 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1335 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1339 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1341 std::vector<int> tmp;
1342 convertPyToNewIntArr3(li,tmp);
1343 self->setSelectedComponents(a,tmp);
1346 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1348 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1349 std::size_t sz(retCpp.size());
1350 PyObject *res(PyList_New(sz));
1351 for(std::size_t i=0;i<sz;i++)
1352 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1356 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1358 int sz=self->getNumberOfComponents();
1359 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1360 self->getTuple(tupleId,tmp);
1361 return convertDblArrToPyList<double>(tmp,sz);
1364 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1366 std::vector<const DataArrayDouble *> tmp;
1367 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1368 return DataArrayDouble::Aggregate(tmp);
1371 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1373 std::vector<const DataArrayDouble *> tmp;
1374 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1375 return DataArrayDouble::Meld(tmp);
1378 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1382 DataArrayDoubleTuple *aa;
1383 std::vector<double> bb;
1385 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1386 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1387 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1388 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1389 DataArrayInt *c=0,*cI=0;
1390 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1391 PyObject *ret=PyTuple_New(2);
1392 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1393 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1397 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1399 DataArrayInt *ret1=0;
1400 bool ret0=self->areIncludedInMe(other,prec,ret1);
1401 PyObject *ret=PyTuple_New(2);
1402 PyObject *ret0Py=ret0?Py_True:Py_False;
1404 PyTuple_SetItem(ret,0,ret0Py);
1405 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1409 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1411 return DataArrayT__getitem<double>(self,obj);
1414 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1416 return DataArrayT__setitem__<double>(self,obj,value);
1419 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1421 return self->negate();
1424 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1426 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1429 DataArrayDoubleTuple *aa;
1430 std::vector<double> bb;
1433 #ifndef WITHOUT_AUTOFIELD
1435 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1437 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1440 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1441 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1443 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1446 throw INTERP_KERNEL::Exception(msg);
1450 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1455 MCAuto<DataArrayDouble> ret=self->deepCopy();
1456 ret->applyLin(1.,val);
1457 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1461 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1465 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1466 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1470 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1471 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1474 throw INTERP_KERNEL::Exception(msg);
1478 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1480 const char msg[]="Unexpected situation in __radd__ !";
1483 DataArrayDoubleTuple *aa;
1484 std::vector<double> bb;
1486 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1491 MCAuto<DataArrayDouble> ret=self->deepCopy();
1492 ret->applyLin(1.,val);
1497 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1498 return DataArrayDouble::Add(self,aaa);
1502 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1503 return DataArrayDouble::Add(self,aaa);
1506 throw INTERP_KERNEL::Exception(msg);
1510 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1512 return DataArrayT_iadd<double>(trueSelf,obj,self);
1515 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1517 const char msg[]="Unexpected situation in __sub__ !";
1520 DataArrayDoubleTuple *aa;
1521 std::vector<double> bb;
1524 #ifndef WITHOUT_AUTOFIELD
1526 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1528 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1531 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1532 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1534 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1537 throw INTERP_KERNEL::Exception(msg);
1541 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1546 MCAuto<DataArrayDouble> ret=self->deepCopy();
1547 ret->applyLin(1.,-val);
1548 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1552 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1556 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1557 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1561 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1562 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1565 throw INTERP_KERNEL::Exception(msg);
1569 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1571 const char msg[]="Unexpected situation in __rsub__ !";
1574 DataArrayDoubleTuple *aa;
1575 std::vector<double> bb;
1577 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1582 MCAuto<DataArrayDouble> ret=self->deepCopy();
1583 ret->applyLin(-1.,val);
1588 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1589 return DataArrayDouble::Substract(aaa,self);
1593 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1594 return DataArrayDouble::Substract(aaa,self);
1597 throw INTERP_KERNEL::Exception(msg);
1601 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1603 return DataArrayT_isub<double>(trueSelf,obj,self);
1606 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1608 const char msg[]="Unexpected situation in __mul__ !";
1611 DataArrayDoubleTuple *aa;
1612 std::vector<double> bb;
1615 #ifndef WITHOUT_AUTOFIELD
1617 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1619 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1622 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1623 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1625 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1628 throw INTERP_KERNEL::Exception(msg);
1632 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1637 MCAuto<DataArrayDouble> ret=self->deepCopy();
1638 ret->applyLin(val,0.);
1639 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1643 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1647 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1648 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1652 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1653 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1656 throw INTERP_KERNEL::Exception(msg);
1660 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1662 const char msg[]="Unexpected situation in __rmul__ !";
1665 DataArrayDoubleTuple *aa;
1666 std::vector<double> bb;
1668 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1673 MCAuto<DataArrayDouble> ret=self->deepCopy();
1674 ret->applyLin(val,0.);
1679 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1680 return DataArrayDouble::Multiply(self,aaa);
1684 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1685 return DataArrayDouble::Multiply(self,aaa);
1688 throw INTERP_KERNEL::Exception(msg);
1692 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1694 return DataArrayT_imul<double>(trueSelf,obj,self);
1697 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1699 const char msg[]="Unexpected situation in __div__ !";
1702 DataArrayDoubleTuple *aa;
1703 std::vector<double> bb;
1706 #ifndef WITHOUT_AUTOFIELD
1708 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1710 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1713 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1714 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1716 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1719 throw INTERP_KERNEL::Exception(msg);
1723 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1729 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1730 MCAuto<DataArrayDouble> ret=self->deepCopy();
1731 ret->applyLin(1/val,0.);
1732 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1736 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1740 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1741 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1745 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1746 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1749 throw INTERP_KERNEL::Exception(msg);
1753 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1755 const char msg[]="Unexpected situation in __rdiv__ !";
1758 DataArrayDoubleTuple *aa;
1759 std::vector<double> bb;
1761 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1766 MCAuto<DataArrayDouble> ret=self->deepCopy();
1772 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1773 return DataArrayDouble::Divide(aaa,self);
1777 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1778 return DataArrayDouble::Divide(aaa,self);
1781 throw INTERP_KERNEL::Exception(msg);
1785 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1787 return DataArrayT_idiv<double>(trueSelf,obj,self);
1790 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1792 const char msg[]="Unexpected situation in __pow__ !";
1795 DataArrayDoubleTuple *aa;
1796 std::vector<double> bb;
1798 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1803 MCAuto<DataArrayDouble> ret=self->deepCopy();
1809 return DataArrayDouble::Pow(self,a);
1813 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1814 return DataArrayDouble::Pow(self,aaa);
1818 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1819 return DataArrayDouble::Pow(self,aaa);
1822 throw INTERP_KERNEL::Exception(msg);
1826 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1828 const char msg[]="Unexpected situation in __rpow__ !";
1831 DataArrayDoubleTuple *aa;
1832 std::vector<double> bb;
1834 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1839 MCAuto<DataArrayDouble> ret=self->deepCopy();
1840 ret->applyRPow(val);
1845 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1846 return DataArrayDouble::Pow(aaa,self);
1850 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1851 return DataArrayDouble::Pow(aaa,self);
1854 throw INTERP_KERNEL::Exception(msg);
1858 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1860 const char msg[]="Unexpected situation in __ipow__ !";
1863 DataArrayDoubleTuple *aa;
1864 std::vector<double> bb;
1866 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1871 self->applyPow(val);
1872 Py_XINCREF(trueSelf);
1878 Py_XINCREF(trueSelf);
1883 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1884 self->powEqual(aaa);
1885 Py_XINCREF(trueSelf);
1890 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1891 self->powEqual(aaa);
1892 Py_XINCREF(trueSelf);
1896 throw INTERP_KERNEL::Exception(msg);
1900 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1902 DataArrayInt *c=0,*cI=0;
1904 self->computeTupleIdsNearTuples(other,eps,c,cI);
1905 PyObject *ret=PyTuple_New(2);
1906 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1907 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1911 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1913 DataArrayInt *ret1=0;
1914 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1915 PyObject *ret=PyTuple_New(2);
1916 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1917 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1922 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
1924 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
1927 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
1930 if(!self->isAllocated())
1931 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
1932 PyObject *ret(PyTuple_New(1));
1933 PyObject *ret0(PyDict_New());
1934 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
1935 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
1936 PyObject *tmp1(PyInt_FromLong(0));
1937 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
1938 PyTuple_SetItem(ret,0,ret0);
1942 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
1948 class DataArrayDoubleTuple;
1950 class DataArrayDoubleIterator
1953 DataArrayDoubleIterator(DataArrayDouble *da);
1954 ~DataArrayDoubleIterator();
1959 DataArrayDoubleTuple *ret=self->nextt();
1961 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1964 PyErr_SetString(PyExc_StopIteration,"No more data.");
1971 class DataArrayDoubleTuple
1974 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
1975 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
1978 std::string __str__() const throw(INTERP_KERNEL::Exception)
1980 return self->repr();
1983 double __float__() const throw(INTERP_KERNEL::Exception)
1985 return self->doubleValue();
1988 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
1990 return self->buildDADouble(1,self->getNumberOfCompo());
1993 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1995 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
1996 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
1997 Py_XINCREF(trueSelf);
2001 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2003 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2004 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2005 Py_XINCREF(trueSelf);
2009 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2011 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2012 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2013 Py_XINCREF(trueSelf);
2017 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2019 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2020 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2021 Py_XINCREF(trueSelf);
2025 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2027 return PyInt_FromLong(self->getNumberOfCompo());
2030 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2032 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2035 std::vector<int> multiVal;
2036 std::pair<int, std::pair<int,int> > slic;
2037 MEDCoupling::DataArrayInt *daIntTyypp=0;
2038 const double *pt=self->getConstPointer();
2039 int nbc=self->getNumberOfCompo();
2040 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2047 std::ostringstream oss;
2048 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2049 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2053 return PyFloat_FromDouble(pt[singleVal]);
2057 return PyFloat_FromDouble(pt[nbc+singleVal]);
2060 std::ostringstream oss;
2061 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2062 throw INTERP_KERNEL::Exception(oss.str().c_str());
2068 PyObject *t=PyTuple_New(multiVal.size());
2069 for(int j=0;j<(int)multiVal.size();j++)
2071 int cid=multiVal[j];
2074 std::ostringstream oss;
2075 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2076 throw INTERP_KERNEL::Exception(oss.str().c_str());
2078 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2084 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2085 PyObject *t=PyTuple_New(sz);
2086 for(int j=0;j<sz;j++)
2087 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2091 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2095 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2097 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2098 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2101 std::vector<double> multiValV;
2102 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2103 int nbc=self->getNumberOfCompo();
2104 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2106 std::vector<int> multiVal;
2107 std::pair<int, std::pair<int,int> > slic;
2108 MEDCoupling::DataArrayInt *daIntTyypp=0;
2109 double *pt=self->getPointer();
2110 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2117 std::ostringstream oss;
2118 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2119 throw INTERP_KERNEL::Exception(oss.str().c_str());
2125 pt[singleVal]=singleValV;
2130 if(multiValV.size()!=1)
2132 std::ostringstream oss;
2133 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2134 throw INTERP_KERNEL::Exception(oss.str().c_str());
2136 pt[singleVal]=multiValV[0];
2141 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2145 throw INTERP_KERNEL::Exception(msg);
2154 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2158 std::ostringstream oss;
2159 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2160 throw INTERP_KERNEL::Exception(oss.str().c_str());
2168 if(multiVal.size()!=multiValV.size())
2170 std::ostringstream oss;
2171 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2172 throw INTERP_KERNEL::Exception(oss.str().c_str());
2174 for(int i=0;i<(int)multiVal.size();i++)
2176 int pos=multiVal[i];
2179 std::ostringstream oss;
2180 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2181 throw INTERP_KERNEL::Exception(oss.str().c_str());
2183 pt[multiVal[i]]=multiValV[i];
2189 const double *ptV=daIntTyyppV->getConstPointer();
2190 if(nbc>daIntTyyppV->getNumberOfCompo())
2192 std::ostringstream oss;
2193 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2194 throw INTERP_KERNEL::Exception(oss.str().c_str());
2196 std::copy(ptV,ptV+nbc,pt);
2200 throw INTERP_KERNEL::Exception(msg);
2205 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2210 for(int j=0;j<sz;j++)
2211 pt[slic.first+j*slic.second.second]=singleValV;
2216 if(sz!=(int)multiValV.size())
2218 std::ostringstream oss;
2219 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
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]=multiValV[j];
2228 const double *ptV=daIntTyyppV->getConstPointer();
2229 if(sz>daIntTyyppV->getNumberOfCompo())
2231 std::ostringstream oss;
2232 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2233 throw INTERP_KERNEL::Exception(oss.str().c_str());
2235 for(int j=0;j<sz;j++)
2236 pt[slic.first+j*slic.second.second]=ptV[j];
2240 throw INTERP_KERNEL::Exception(msg);
2244 throw INTERP_KERNEL::Exception(msg);
2250 class DataArrayIntIterator;
2252 class DataArrayInt : public DataArray
2255 static DataArrayInt *New();
2256 int intValue() const throw(INTERP_KERNEL::Exception);
2257 int getHashCode() const throw(INTERP_KERNEL::Exception);
2258 bool empty() const throw(INTERP_KERNEL::Exception);
2259 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2260 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2261 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2262 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2263 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2264 int popBackSilent() throw(INTERP_KERNEL::Exception);
2265 void pack() const throw(INTERP_KERNEL::Exception);
2266 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2267 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2268 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2269 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2270 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2271 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2272 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2273 void reverse() throw(INTERP_KERNEL::Exception);
2274 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2275 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2276 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2277 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2278 void fillWithZero() throw(INTERP_KERNEL::Exception);
2279 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2280 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2281 std::string repr() const throw(INTERP_KERNEL::Exception);
2282 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2283 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2284 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2285 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2286 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2287 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2288 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2289 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2290 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2291 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2292 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2293 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2294 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2295 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2296 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2297 void transpose() throw(INTERP_KERNEL::Exception);
2298 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2299 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2300 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2301 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2302 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2303 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2304 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2305 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2306 int front() const throw(INTERP_KERNEL::Exception);
2307 int back() const throw(INTERP_KERNEL::Exception);
2308 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2309 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2310 int *getPointer() throw(INTERP_KERNEL::Exception);
2311 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2312 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2313 const int *begin() const throw(INTERP_KERNEL::Exception);
2314 const int *end() const throw(INTERP_KERNEL::Exception);
2315 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2316 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2317 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2318 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2319 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2320 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2321 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2322 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2323 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2324 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2325 int count(int value) const throw(INTERP_KERNEL::Exception);
2326 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2327 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2328 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2329 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2330 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2331 void abs() throw(INTERP_KERNEL::Exception);
2332 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2333 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2334 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2335 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2336 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2337 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2338 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2339 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2340 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2341 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2342 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2343 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2344 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2345 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2346 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2347 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2348 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2349 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2350 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2351 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2352 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2353 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2354 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2355 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2356 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2357 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2358 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2359 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2360 void computeOffsets() throw(INTERP_KERNEL::Exception);
2361 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2362 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2363 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2364 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2365 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2366 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2367 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2368 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2369 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2370 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2371 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2372 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2373 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2374 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2375 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2376 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2377 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2378 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2379 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2380 MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
2381 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2382 MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
2383 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2384 MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
2385 MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
2386 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
2387 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
2389 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2392 DataArrayInt() throw(INTERP_KERNEL::Exception)
2394 return DataArrayInt::New();
2397 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2399 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)";
2400 std::string msg(msgBase);
2402 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2405 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2409 if(PyInt_Check(nbOfTuples))
2411 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2413 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2416 if(PyInt_Check(nbOfComp))
2417 {//DataArrayInt.New([1,3,4,5],2,2)
2418 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2420 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2421 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2422 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2423 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2427 throw INTERP_KERNEL::Exception(msg.c_str());
2430 {//DataArrayInt.New([1,3,4],3)
2431 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2433 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2434 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2439 throw INTERP_KERNEL::Exception(msg.c_str());
2442 {// DataArrayInt.New([1,3,4])
2443 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2444 int tmpp1=-1,tmpp2=-1;
2445 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2446 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2450 else if(PyInt_Check(elt0))
2452 int nbOfTuples1=PyInt_AS_LONG(elt0);
2454 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2459 if(PyInt_Check(nbOfTuples))
2460 {//DataArrayInt.New(5,2)
2461 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2463 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2464 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2465 ret->alloc(nbOfTuples1,nbOfCompo);
2469 throw INTERP_KERNEL::Exception(msg.c_str());
2472 throw INTERP_KERNEL::Exception(msg.c_str());
2475 {//DataArrayInt.New(5)
2476 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2477 ret->alloc(nbOfTuples1,1);
2482 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2483 {//DataArrayInt.New(numpyArray)
2484 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2488 throw INTERP_KERNEL::Exception(msg.c_str());
2489 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2492 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2494 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2497 std::string __str__() const throw(INTERP_KERNEL::Exception)
2499 return self->reprNotTooLong();
2502 int __len__() const throw(INTERP_KERNEL::Exception)
2504 if(self->isAllocated())
2506 return self->getNumberOfTuples();
2510 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2514 int __int__() const throw(INTERP_KERNEL::Exception)
2516 return self->intValue();
2519 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2521 return self->iterator();
2524 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2526 int sz=self->getNumberOfComponents();
2527 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2528 self->accumulate(tmp);
2529 return convertIntArrToPyList(tmp,sz);
2532 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2535 std::vector<int> val2;
2536 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2537 return self->accumulatePerChunck(bg,bg+sz);
2540 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2543 std::vector<int> val2;
2544 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2545 return self->findIdsEqualTuple(bg,bg+sz);
2548 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2550 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2551 PyObject *ret=PyList_New(slcs.size());
2552 for(std::size_t i=0;i<slcs.size();i++)
2553 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2557 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2559 if(!PySlice_Check(slic))
2560 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2561 Py_ssize_t strt=2,stp=2,step=2;
2562 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2563 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2564 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2565 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 !");
2566 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2569 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2572 self->getMinMaxValues(a,b);
2573 PyObject *ret=PyTuple_New(2);
2574 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2575 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2579 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2581 int newNbOfTuples=-1;
2582 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2583 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2584 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2585 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2586 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2587 PyObject *ret=PyTuple_New(2);
2588 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2589 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2593 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2595 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2596 int szArr,sw,iTypppArr;
2597 std::vector<int> stdvecTyyppArr;
2598 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2599 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2600 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2604 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2606 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 !";
2607 if(PyList_Check(li) || PyTuple_Check(li))
2609 if(nbOfTuples && nbOfTuples != Py_None)
2611 if(PyInt_Check(nbOfTuples))
2613 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2615 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2616 if(nbOfComp && nbOfComp != Py_None)
2618 if(PyInt_Check(nbOfComp))
2619 {//DataArrayInt.setValues([1,3,4,5],2,2)
2620 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2622 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2623 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2624 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2627 throw INTERP_KERNEL::Exception(msg);
2630 {//DataArrayInt.setValues([1,3,4],3)
2632 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2633 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2637 throw INTERP_KERNEL::Exception(msg);
2640 {// DataArrayInt.setValues([1,3,4])
2641 int tmpp1=-1,tmpp2=-1;
2642 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2643 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2647 throw INTERP_KERNEL::Exception(msg);
2650 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2652 const int *vals=self->getConstPointer();
2653 return convertIntArrToPyList(vals,self->getNbOfElems());
2657 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2659 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2663 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2666 bool ret0=self->isEqualIfNotWhy(other,ret1);
2667 PyObject *ret=PyTuple_New(2);
2668 PyObject *ret0Py=ret0?Py_True:Py_False;
2670 PyTuple_SetItem(ret,0,ret0Py);
2671 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2675 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2677 const int *vals=self->getConstPointer();
2678 int nbOfComp=self->getNumberOfComponents();
2679 int nbOfTuples=self->getNumberOfTuples();
2680 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2683 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2685 std::vector<const DataArrayInt *> groups;
2686 std::vector< std::vector<int> > fidsOfGroups;
2687 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2688 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2689 PyObject *ret = PyList_New(2);
2690 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2691 int sz=fidsOfGroups.size();
2692 PyObject *ret1 = PyList_New(sz);
2693 for(int i=0;i<sz;i++)
2694 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2695 PyList_SetItem(ret,1,ret1);
2699 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2702 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2703 if (!SWIG_IsOK(res1))
2706 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2707 self->transformWithIndArr(tmp,tmp+size);
2711 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2712 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2716 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2720 std::vector<int> multiVal;
2721 std::pair<int, std::pair<int,int> > slic;
2722 MEDCoupling::DataArrayInt *daIntTyypp=0;
2723 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2727 return self->findIdsEqualList(&singleVal,&singleVal+1);
2729 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2731 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2733 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2737 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2741 std::vector<int> multiVal;
2742 std::pair<int, std::pair<int,int> > slic;
2743 MEDCoupling::DataArrayInt *daIntTyypp=0;
2744 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2748 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2750 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2752 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2754 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2758 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2760 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2762 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2763 if (!SWIG_IsOK(res1))
2766 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2767 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2771 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2773 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2774 da2->checkAllocated();
2775 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2777 PyObject *ret = PyList_New(3);
2778 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2779 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2780 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2784 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2787 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2788 if (!SWIG_IsOK(res1))
2791 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2792 return self->transformWithIndArrR(tmp,tmp+size);
2796 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2797 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2801 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2804 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2805 if (!SWIG_IsOK(res1))
2808 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2809 if(size!=self->getNumberOfTuples())
2811 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2813 return self->renumberAndReduce(tmp,newNbOfTuple);
2817 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2819 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2820 da2->checkAllocated();
2821 int size=self->getNumberOfTuples();
2822 if(size!=self->getNumberOfTuples())
2824 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2826 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2830 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2833 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2834 if (!SWIG_IsOK(res1))
2837 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2838 if(size!=self->getNumberOfTuples())
2840 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2842 return self->renumber(tmp);
2846 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2848 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2849 da2->checkAllocated();
2850 int size=self->getNumberOfTuples();
2851 if(size!=self->getNumberOfTuples())
2853 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2855 return self->renumber(da2->getConstPointer());
2859 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2862 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2863 if (!SWIG_IsOK(res1))
2866 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2867 if(size!=self->getNumberOfTuples())
2869 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2871 return self->renumberR(tmp);
2875 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2877 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2878 da2->checkAllocated();
2879 int size=self->getNumberOfTuples();
2880 if(size!=self->getNumberOfTuples())
2882 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2884 return self->renumberR(da2->getConstPointer());
2888 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2890 std::vector<int> tmp;
2891 convertPyToNewIntArr3(li,tmp);
2892 self->setSelectedComponents(a,tmp);
2895 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2897 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2898 std::size_t sz(retCpp.size());
2899 PyObject *res(PyList_New(sz));
2900 for(std::size_t i=0;i<sz;i++)
2901 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2905 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2907 int sz=self->getNumberOfComponents();
2908 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2909 self->getTuple(tupleId,tmp);
2910 return convertIntArrToPyList(tmp,sz);
2913 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2915 DataArrayInt *arr=0;
2916 DataArrayInt *arrI=0;
2917 self->changeSurjectiveFormat(targetNb,arr,arrI);
2918 PyObject *res = PyList_New(2);
2919 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2920 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2924 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2926 std::vector<const DataArrayInt *> tmp;
2927 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2928 return DataArrayInt::Meld(tmp);
2931 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2933 std::vector<const DataArrayInt *> tmp;
2934 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2935 return DataArrayInt::Aggregate(tmp);
2938 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2940 std::vector<const DataArrayInt *> tmp;
2941 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2942 return DataArrayInt::AggregateIndexes(tmp);
2945 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2947 std::vector<const DataArrayInt *> tmp;
2948 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2949 return DataArrayInt::BuildUnion(tmp);
2952 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2954 std::vector<const DataArrayInt *> tmp;
2955 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2956 return DataArrayInt::BuildIntersection(tmp);
2959 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2962 int r1=self->getMaxValue(tmp);
2963 PyObject *ret=PyTuple_New(2);
2964 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2965 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2969 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2972 int r1=self->getMinValue(tmp);
2973 PyObject *ret=PyTuple_New(2);
2974 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2975 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2979 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2981 int nbOfCompo=self->getNumberOfComponents();
2986 if(PyInt_Check(obj))
2988 int val=(int)PyInt_AS_LONG(obj);
2989 return self->findIdFirstEqual(val);
2992 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
2996 std::vector<int> arr;
2997 convertPyToNewIntArr3(obj,arr);
2998 return self->findIdFirstEqualTuple(arr);
3003 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3005 int nbOfCompo=self->getNumberOfComponents();
3012 if(PyInt_Check(obj))
3014 int val=(int)PyInt_AS_LONG(obj);
3015 return self->presenceOfValue(val);
3018 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3022 std::vector<int> arr;
3023 convertPyToNewIntArr3(obj,arr);
3024 return self->presenceOfTuple(arr);
3029 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3031 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3032 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3033 self->checkAllocated();
3034 int nbOfTuples=self->getNumberOfTuples();
3035 int nbOfComponents=self->getNumberOfComponents();
3037 std::vector<int> vt1,vc1;
3038 std::pair<int, std::pair<int,int> > pt1,pc1;
3039 DataArrayInt *dt1=0,*dc1=0;
3041 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3042 MCAuto<DataArrayInt> ret;
3047 if(nbOfComponents==1)
3048 return PyInt_FromLong(self->getIJSafe(it1,0));
3049 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3052 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3054 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3056 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3058 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3061 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3062 std::vector<int> v2(1,ic1);
3063 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3067 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3068 std::vector<int> v2(1,ic1);
3069 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3073 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3074 std::vector<int> v2(1,ic1);
3075 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3079 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3080 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3084 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3085 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3089 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3090 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3094 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3095 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3099 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3100 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3101 std::vector<int> v2(nbOfComp);
3102 for(int i=0;i<nbOfComp;i++)
3103 v2[i]=pc1.first+i*pc1.second.second;
3104 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3108 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3109 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3110 std::vector<int> v2(nbOfComp);
3111 for(int i=0;i<nbOfComp;i++)
3112 v2[i]=pc1.first+i*pc1.second.second;
3113 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3117 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3118 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3119 std::vector<int> v2(nbOfComp);
3120 for(int i=0;i<nbOfComp;i++)
3121 v2[i]=pc1.first+i*pc1.second.second;
3122 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3126 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3127 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3128 std::vector<int> v2(nbOfComp);
3129 for(int i=0;i<nbOfComp;i++)
3130 v2[i]=pc1.first+i*pc1.second.second;
3131 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3134 throw INTERP_KERNEL::Exception(msg);
3138 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3140 self->checkAllocated();
3141 const char msg[]="Unexpected situation in __setitem__ !";
3142 int nbOfTuples=self->getNumberOfTuples();
3143 int nbOfComponents=self->getNumberOfComponents();
3146 std::vector<int> v1;
3148 DataArrayIntTuple *dd1=0;
3149 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3151 std::vector<int> vt1,vc1;
3152 std::pair<int, std::pair<int,int> > pt1,pc1;
3153 DataArrayInt *dt1=0,*dc1=0;
3154 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3155 MCAuto<DataArrayInt> tmp;
3163 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3166 tmp=DataArrayInt::New();
3167 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3168 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3171 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3174 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3175 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3178 throw INTERP_KERNEL::Exception(msg);
3187 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3190 tmp=DataArrayInt::New();
3191 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3192 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3195 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3198 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3199 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3202 throw INTERP_KERNEL::Exception(msg);
3211 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3214 tmp=DataArrayInt::New();
3215 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3216 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3219 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3222 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3223 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3226 throw INTERP_KERNEL::Exception(msg);
3235 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3238 tmp=DataArrayInt::New();
3239 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3240 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3243 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3246 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3247 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3250 throw INTERP_KERNEL::Exception(msg);
3259 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3262 tmp=DataArrayInt::New();
3263 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3264 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3267 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3270 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3271 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3274 throw INTERP_KERNEL::Exception(msg);
3283 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3286 tmp=DataArrayInt::New();
3287 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3288 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3291 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3294 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3295 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3298 throw INTERP_KERNEL::Exception(msg);
3307 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3310 tmp=DataArrayInt::New();
3311 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3312 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3315 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3318 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3319 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3322 throw INTERP_KERNEL::Exception(msg);
3331 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3334 tmp=DataArrayInt::New();
3335 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3336 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3339 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3342 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3343 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3346 throw INTERP_KERNEL::Exception(msg);
3355 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3358 tmp=DataArrayInt::New();
3359 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3360 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3363 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3366 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3367 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3370 throw INTERP_KERNEL::Exception(msg);
3379 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3382 tmp=DataArrayInt::New();
3383 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3384 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3387 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3390 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3391 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3394 throw INTERP_KERNEL::Exception(msg);
3403 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3406 tmp=DataArrayInt::New();
3407 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3408 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3411 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3414 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3415 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3418 throw INTERP_KERNEL::Exception(msg);
3427 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3430 tmp=DataArrayInt::New();
3431 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3432 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3435 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3438 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3439 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3442 throw INTERP_KERNEL::Exception(msg);
3451 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3454 tmp=DataArrayInt::New();
3455 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3456 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3459 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3462 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3463 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3466 throw INTERP_KERNEL::Exception(msg);
3475 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3478 tmp=DataArrayInt::New();
3479 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3480 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3483 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3486 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3487 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3490 throw INTERP_KERNEL::Exception(msg);
3499 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3502 tmp=DataArrayInt::New();
3503 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3504 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3507 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3510 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3511 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3514 throw INTERP_KERNEL::Exception(msg);
3523 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3526 tmp=DataArrayInt::New();
3527 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3528 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3531 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3534 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3535 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3538 throw INTERP_KERNEL::Exception(msg);
3543 throw INTERP_KERNEL::Exception(msg);
3548 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3550 return self->negate();
3553 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3555 const char msg[]="Unexpected situation in __add__ !";
3558 std::vector<int> aa;
3559 DataArrayIntTuple *aaa;
3561 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3566 MCAuto<DataArrayInt> ret=self->deepCopy();
3567 ret->applyLin(1,val);
3572 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3573 return DataArrayInt::Add(self,aaaa);
3577 return DataArrayInt::Add(self,a);
3581 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3582 return DataArrayInt::Add(self,aaaa);
3585 throw INTERP_KERNEL::Exception(msg);
3589 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3591 const char msg[]="Unexpected situation in __radd__ !";
3594 std::vector<int> aa;
3595 DataArrayIntTuple *aaa;
3597 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3602 MCAuto<DataArrayInt> ret=self->deepCopy();
3603 ret->applyLin(1,val);
3608 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3609 return DataArrayInt::Add(self,aaaa);
3613 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3614 return DataArrayInt::Add(self,aaaa);
3617 throw INTERP_KERNEL::Exception(msg);
3621 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3623 const char msg[]="Unexpected situation in __iadd__ !";
3626 std::vector<int> aa;
3627 DataArrayIntTuple *aaa;
3629 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3634 self->applyLin(1,val);
3635 Py_XINCREF(trueSelf);
3640 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3642 Py_XINCREF(trueSelf);
3648 Py_XINCREF(trueSelf);
3653 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3654 self->addEqual(aaaa);
3655 Py_XINCREF(trueSelf);
3659 throw INTERP_KERNEL::Exception(msg);
3663 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3665 const char msg[]="Unexpected situation in __sub__ !";
3668 std::vector<int> aa;
3669 DataArrayIntTuple *aaa;
3671 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3676 MCAuto<DataArrayInt> ret=self->deepCopy();
3677 ret->applyLin(1,-val);
3682 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3683 return DataArrayInt::Substract(self,aaaa);
3687 return DataArrayInt::Substract(self,a);
3691 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3692 return DataArrayInt::Substract(self,aaaa);
3695 throw INTERP_KERNEL::Exception(msg);
3699 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3701 const char msg[]="Unexpected situation in __rsub__ !";
3704 std::vector<int> aa;
3705 DataArrayIntTuple *aaa;
3707 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3712 MCAuto<DataArrayInt> ret=self->deepCopy();
3713 ret->applyLin(-1,val);
3718 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3719 return DataArrayInt::Substract(aaaa,self);
3723 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3724 return DataArrayInt::Substract(aaaa,self);
3727 throw INTERP_KERNEL::Exception(msg);
3731 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3733 const char msg[]="Unexpected situation in __isub__ !";
3736 std::vector<int> aa;
3737 DataArrayIntTuple *aaa;
3739 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3744 self->applyLin(1,-val);
3745 Py_XINCREF(trueSelf);
3750 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3751 self->substractEqual(bb);
3752 Py_XINCREF(trueSelf);
3757 self->substractEqual(a);
3758 Py_XINCREF(trueSelf);
3763 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3764 self->substractEqual(aaaa);
3765 Py_XINCREF(trueSelf);
3769 throw INTERP_KERNEL::Exception(msg);
3773 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3775 const char msg[]="Unexpected situation in __mul__ !";
3778 std::vector<int> aa;
3779 DataArrayIntTuple *aaa;
3781 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3786 MCAuto<DataArrayInt> ret=self->deepCopy();
3787 ret->applyLin(val,0);
3792 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3793 return DataArrayInt::Multiply(self,aaaa);
3797 return DataArrayInt::Multiply(self,a);
3801 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3802 return DataArrayInt::Multiply(self,aaaa);
3805 throw INTERP_KERNEL::Exception(msg);
3809 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3811 const char msg[]="Unexpected situation in __rmul__ !";
3814 std::vector<int> aa;
3815 DataArrayIntTuple *aaa;
3817 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3822 MCAuto<DataArrayInt> ret=self->deepCopy();
3823 ret->applyLin(val,0);
3828 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3829 return DataArrayInt::Multiply(self,aaaa);
3833 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3834 return DataArrayInt::Multiply(self,aaaa);
3837 throw INTERP_KERNEL::Exception(msg);
3841 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3843 const char msg[]="Unexpected situation in __imul__ !";
3846 std::vector<int> aa;
3847 DataArrayIntTuple *aaa;
3849 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3854 self->applyLin(val,0);
3855 Py_XINCREF(trueSelf);
3860 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3861 self->multiplyEqual(bb);
3862 Py_XINCREF(trueSelf);
3867 self->multiplyEqual(a);
3868 Py_XINCREF(trueSelf);
3873 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3874 self->multiplyEqual(aaaa);
3875 Py_XINCREF(trueSelf);
3879 throw INTERP_KERNEL::Exception(msg);
3883 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3885 const char msg[]="Unexpected situation in __div__ !";
3888 std::vector<int> aa;
3889 DataArrayIntTuple *aaa;
3891 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3896 MCAuto<DataArrayInt> ret=self->deepCopy();
3897 ret->applyDivideBy(val);
3902 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3903 return DataArrayInt::Divide(self,aaaa);
3907 return DataArrayInt::Divide(self,a);
3911 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3912 return DataArrayInt::Divide(self,aaaa);
3915 throw INTERP_KERNEL::Exception(msg);
3919 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3921 const char msg[]="Unexpected situation in __rdiv__ !";
3924 std::vector<int> aa;
3925 DataArrayIntTuple *aaa;
3927 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3932 MCAuto<DataArrayInt> ret=self->deepCopy();
3938 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3939 return DataArrayInt::Divide(aaaa,self);
3943 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3944 return DataArrayInt::Divide(aaaa,self);
3947 throw INTERP_KERNEL::Exception(msg);
3951 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3953 const char msg[]="Unexpected situation in __idiv__ !";
3956 std::vector<int> aa;
3957 DataArrayIntTuple *aaa;
3959 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3964 self->applyDivideBy(val);
3965 Py_XINCREF(trueSelf);
3970 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3971 self->divideEqual(bb);
3972 Py_XINCREF(trueSelf);
3977 self->divideEqual(a);
3978 Py_XINCREF(trueSelf);
3983 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3984 self->divideEqual(aaaa);
3985 Py_XINCREF(trueSelf);
3989 throw INTERP_KERNEL::Exception(msg);
3993 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3995 const char msg[]="Unexpected situation in __mod__ !";
3998 std::vector<int> aa;
3999 DataArrayIntTuple *aaa;
4001 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4006 MCAuto<DataArrayInt> ret=self->deepCopy();
4007 ret->applyModulus(val);
4012 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4013 return DataArrayInt::Modulus(self,aaaa);
4017 return DataArrayInt::Modulus(self,a);
4021 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4022 return DataArrayInt::Modulus(self,aaaa);
4025 throw INTERP_KERNEL::Exception(msg);
4029 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4031 const char msg[]="Unexpected situation in __rmod__ !";
4034 std::vector<int> aa;
4035 DataArrayIntTuple *aaa;
4037 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4042 MCAuto<DataArrayInt> ret=self->deepCopy();
4043 ret->applyRModulus(val);
4048 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4049 return DataArrayInt::Modulus(aaaa,self);
4053 return DataArrayInt::Modulus(a,self);
4057 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4058 return DataArrayInt::Modulus(aaaa,self);
4061 throw INTERP_KERNEL::Exception(msg);
4065 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4067 const char msg[]="Unexpected situation in __imod__ !";
4070 std::vector<int> aa;
4071 DataArrayIntTuple *aaa;
4073 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4078 self->applyModulus(val);
4079 Py_XINCREF(trueSelf);
4084 self->modulusEqual(a);
4085 Py_XINCREF(trueSelf);
4090 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4091 self->modulusEqual(aaaa);
4092 Py_XINCREF(trueSelf);
4096 throw INTERP_KERNEL::Exception(msg);
4100 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4102 const char msg[]="Unexpected situation in __pow__ !";
4105 std::vector<int> aa;
4106 DataArrayIntTuple *aaa;
4108 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4113 MCAuto<DataArrayInt> ret=self->deepCopy();
4119 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4120 return DataArrayInt::Pow(self,aaaa);
4124 return DataArrayInt::Pow(self,a);
4128 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4129 return DataArrayInt::Pow(self,aaaa);
4132 throw INTERP_KERNEL::Exception(msg);
4136 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4138 const char msg[]="Unexpected situation in __rpow__ !";
4141 std::vector<int> aa;
4142 DataArrayIntTuple *aaa;
4144 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4149 MCAuto<DataArrayInt> ret=self->deepCopy();
4150 ret->applyRPow(val);
4155 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4156 return DataArrayInt::Pow(aaaa,self);
4160 return DataArrayInt::Pow(a,self);
4164 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4165 return DataArrayInt::Pow(aaaa,self);
4168 throw INTERP_KERNEL::Exception(msg);
4172 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4174 const char msg[]="Unexpected situation in __ipow__ !";
4177 std::vector<int> aa;
4178 DataArrayIntTuple *aaa;
4180 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4185 self->applyPow(val);
4186 Py_XINCREF(trueSelf);
4192 Py_XINCREF(trueSelf);
4197 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4198 self->powEqual(aaaa);
4199 Py_XINCREF(trueSelf);
4203 throw INTERP_KERNEL::Exception(msg);
4207 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4209 std::ostringstream oss;
4210 self->reprQuickOverview(oss);
4214 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4216 int szArr,sw,iTypppArr;
4217 std::vector<int> stdvecTyyppArr;
4218 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4219 self->pushBackValsSilent(tmp,tmp+szArr);
4222 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4224 std::vector<int> ret1;
4225 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4226 std::size_t sz=ret0.size();
4227 PyObject *pyRet=PyTuple_New(2);
4228 PyObject *pyRet0=PyList_New((int)sz);
4229 PyObject *pyRet1=PyList_New((int)sz);
4230 for(std::size_t i=0;i<sz;i++)
4232 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4233 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4235 PyTuple_SetItem(pyRet,0,pyRet0);
4236 PyTuple_SetItem(pyRet,1,pyRet1);
4240 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4242 DataArrayInt *ret0=0,*ret1=0;
4243 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4244 PyObject *pyRet=PyTuple_New(2);
4245 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4246 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4250 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4253 bool ret(self->isRange(a,b,c));
4254 PyObject *pyRet=PyTuple_New(2);
4255 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4257 PyTuple_SetItem(pyRet,0,ret0Py);
4259 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4265 PyTuple_SetItem(pyRet,1,ret1Py);
4270 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4272 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4275 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4278 if(!self->isAllocated())
4279 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4280 PyObject *ret(PyTuple_New(1));
4281 PyObject *ret0(PyDict_New());
4282 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4283 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4284 PyObject *tmp1(PyInt_FromLong(0));
4285 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4286 PyTuple_SetItem(ret,0,ret0);
4290 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4296 class DataArrayIntTuple;
4298 class DataArrayIntIterator
4301 DataArrayIntIterator(DataArrayInt *da);
4302 ~DataArrayIntIterator();
4307 DataArrayIntTuple *ret=self->nextt();
4309 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4312 PyErr_SetString(PyExc_StopIteration,"No more data.");
4319 class DataArrayIntTuple
4322 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4323 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4326 std::string __str__() const throw(INTERP_KERNEL::Exception)
4328 return self->repr();
4331 int __int__() const throw(INTERP_KERNEL::Exception)
4333 return self->intValue();
4336 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4338 return self->buildDAInt(1,self->getNumberOfCompo());
4341 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4343 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4344 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4345 Py_XINCREF(trueSelf);
4349 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4351 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4352 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4353 Py_XINCREF(trueSelf);
4357 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4359 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4360 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4361 Py_XINCREF(trueSelf);
4365 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4367 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4368 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4369 Py_XINCREF(trueSelf);
4373 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4375 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4376 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4377 Py_XINCREF(trueSelf);
4381 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4383 return PyInt_FromLong(self->getNumberOfCompo());
4386 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4388 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4391 std::vector<int> multiVal;
4392 std::pair<int, std::pair<int,int> > slic;
4393 MEDCoupling::DataArrayInt *daIntTyypp=0;
4394 const int *pt=self->getConstPointer();
4395 int nbc=self->getNumberOfCompo();
4396 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4403 std::ostringstream oss;
4404 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4405 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4409 return PyInt_FromLong(pt[singleVal]);
4413 return PyInt_FromLong(pt[nbc+singleVal]);
4416 std::ostringstream oss;
4417 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4418 throw INTERP_KERNEL::Exception(oss.str().c_str());
4424 PyObject *t=PyTuple_New(multiVal.size());
4425 for(int j=0;j<(int)multiVal.size();j++)
4427 int cid=multiVal[j];
4430 std::ostringstream oss;
4431 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4432 throw INTERP_KERNEL::Exception(oss.str().c_str());
4434 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4440 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4441 PyObject *t=PyTuple_New(sz);
4442 for(int j=0;j<sz;j++)
4443 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4447 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4451 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4453 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4454 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4457 std::vector<int> multiValV;
4458 std::pair<int, std::pair<int,int> > slicV;
4459 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4460 int nbc=self->getNumberOfCompo();
4461 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4463 std::vector<int> multiVal;
4464 std::pair<int, std::pair<int,int> > slic;
4465 MEDCoupling::DataArrayInt *daIntTyypp=0;
4466 int *pt=self->getPointer();
4467 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4474 std::ostringstream oss;
4475 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4476 throw INTERP_KERNEL::Exception(oss.str().c_str());
4482 pt[singleVal]=singleValV;
4487 if(multiValV.size()!=1)
4489 std::ostringstream oss;
4490 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4491 throw INTERP_KERNEL::Exception(oss.str().c_str());
4493 pt[singleVal]=multiValV[0];
4498 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4502 throw INTERP_KERNEL::Exception(msg);
4511 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4515 std::ostringstream oss;
4516 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4517 throw INTERP_KERNEL::Exception(oss.str().c_str());
4525 if(multiVal.size()!=multiValV.size())
4527 std::ostringstream oss;
4528 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4529 throw INTERP_KERNEL::Exception(oss.str().c_str());
4531 for(int i=0;i<(int)multiVal.size();i++)
4533 int pos=multiVal[i];
4536 std::ostringstream oss;
4537 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4538 throw INTERP_KERNEL::Exception(oss.str().c_str());
4540 pt[multiVal[i]]=multiValV[i];
4546 const int *ptV=daIntTyyppV->getConstPointer();
4547 if(nbc>daIntTyyppV->getNumberOfCompo())
4549 std::ostringstream oss;
4550 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4551 throw INTERP_KERNEL::Exception(oss.str().c_str());
4553 std::copy(ptV,ptV+nbc,pt);
4557 throw INTERP_KERNEL::Exception(msg);
4562 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4567 for(int j=0;j<sz;j++)
4568 pt[slic.first+j*slic.second.second]=singleValV;
4573 if(sz!=(int)multiValV.size())
4575 std::ostringstream oss;
4576 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4577 throw INTERP_KERNEL::Exception(oss.str().c_str());
4579 for(int j=0;j<sz;j++)
4580 pt[slic.first+j*slic.second.second]=multiValV[j];
4585 const int *ptV=daIntTyyppV->getConstPointer();
4586 if(sz>daIntTyyppV->getNumberOfCompo())
4588 std::ostringstream oss;
4589 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4590 throw INTERP_KERNEL::Exception(oss.str().c_str());
4592 for(int j=0;j<sz;j++)
4593 pt[slic.first+j*slic.second.second]=ptV[j];
4597 throw INTERP_KERNEL::Exception(msg);
4601 throw INTERP_KERNEL::Exception(msg);
4607 class DataArrayChar : public DataArray
4610 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4611 int getHashCode() const throw(INTERP_KERNEL::Exception);
4612 bool empty() const throw(INTERP_KERNEL::Exception);
4613 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4614 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4615 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4616 char popBackSilent() throw(INTERP_KERNEL::Exception);
4617 void pack() const throw(INTERP_KERNEL::Exception);
4618 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4619 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4620 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4621 void reverse() throw(INTERP_KERNEL::Exception);
4622 void fillWithZero() throw(INTERP_KERNEL::Exception);
4623 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4624 std::string repr() const throw(INTERP_KERNEL::Exception);
4625 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4626 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4627 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4628 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4629 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4630 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4631 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4632 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4633 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4634 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4635 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4636 char front() const throw(INTERP_KERNEL::Exception);
4637 char back() const throw(INTERP_KERNEL::Exception);
4638 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4639 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4640 char *getPointer() throw(INTERP_KERNEL::Exception);
4641 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4642 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4643 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4644 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4645 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4646 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4647 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4648 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4649 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4650 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4651 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4654 int __len__() const throw(INTERP_KERNEL::Exception)
4656 if(self->isAllocated())
4658 return self->getNumberOfTuples();
4662 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4666 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4669 bool ret0=self->isEqualIfNotWhy(other,ret1);
4670 PyObject *ret=PyTuple_New(2);
4671 PyObject *ret0Py=ret0?Py_True:Py_False;
4673 PyTuple_SetItem(ret,0,ret0Py);
4674 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4678 DataArrayChar *renumber(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->renumber(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->renumber(da2->getConstPointer());
4707 DataArrayChar *renumberR(PyObject *li) 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->renumberR(tmp);
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->renumberR(da2->getConstPointer());
4736 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4739 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4740 if (!SWIG_IsOK(res1))
4743 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4744 if(size!=self->getNumberOfTuples())
4746 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4748 return self->renumberAndReduce(tmp,newNbOfTuple);
4752 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4754 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4755 da2->checkAllocated();
4756 int size=self->getNumberOfTuples();
4757 if(size!=self->getNumberOfTuples())
4759 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4761 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4765 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4767 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4768 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4769 return DataArrayChar::Aggregate(tmp);
4772 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4774 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4775 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4776 return DataArrayChar::Meld(tmp);
4781 class DataArrayByteIterator;
4783 class DataArrayByte : public DataArrayChar
4786 static DataArrayByte *New();
4787 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4788 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4789 char byteValue() const throw(INTERP_KERNEL::Exception);
4792 DataArrayByte() throw(INTERP_KERNEL::Exception)
4794 return DataArrayByte::New();
4797 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4799 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) !";
4800 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4804 if(PyInt_Check(nbOfTuples))
4806 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4808 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4811 if(PyInt_Check(nbOfComp))
4812 {//DataArrayByte.New([1,3,4,5],2,2)
4813 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4815 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4816 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4817 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4818 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4822 throw INTERP_KERNEL::Exception(msg);
4825 {//DataArrayByte.New([1,3,4],3)
4826 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4828 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4829 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4834 throw INTERP_KERNEL::Exception(msg);
4837 {// DataArrayByte.New([1,3,4])
4838 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4839 int tmpp1=-1,tmpp2=-1;
4840 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4841 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4845 else if(PyInt_Check(elt0))
4847 int nbOfTuples1=PyInt_AS_LONG(elt0);
4849 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4854 if(PyInt_Check(nbOfTuples))
4855 {//DataArrayByte.New(5,2)
4856 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4858 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4859 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4860 ret->alloc(nbOfTuples1,nbOfCompo);
4864 throw INTERP_KERNEL::Exception(msg);
4867 throw INTERP_KERNEL::Exception(msg);
4870 {//DataArrayByte.New(5)
4871 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4872 ret->alloc(nbOfTuples1,1);
4877 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4878 {//DataArrayDouble.New(numpyArray)
4879 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4883 throw INTERP_KERNEL::Exception(msg);
4886 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4888 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4891 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4893 std::ostringstream oss;
4894 self->reprQuickOverview(oss);
4898 int __int__() const throw(INTERP_KERNEL::Exception)
4900 return (int) self->byteValue();
4903 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4905 return self->iterator();
4908 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4910 return (int)self->getIJ(tupleId,compoId);
4913 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4915 return (int)self->getIJSafe(tupleId,compoId);
4918 std::string __str__() const throw(INTERP_KERNEL::Exception)
4920 return self->repr();
4923 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4925 const char *vals=self->getConstPointer();
4926 int nbOfComp=self->getNumberOfComponents();
4927 int nbOfTuples=self->getNumberOfTuples();
4928 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4931 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4934 int ival=-1; std::vector<int> ivval;
4935 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4936 std::vector<char> vals(sz);
4937 std::copy(pt,pt+sz,vals.begin());
4938 return self->presenceOfTuple(vals);
4941 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4944 int ival=-1; std::vector<int> ivval;
4945 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4946 std::vector<char> vals2(sz);
4947 std::copy(pt,pt+sz,vals2.begin());
4948 return self->presenceOfValue(vals2);
4951 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4954 int ival=-1; std::vector<int> ivval;
4955 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4956 std::vector<char> vals2(sz);
4957 std::copy(pt,pt+sz,vals2.begin());
4958 return self->findIdFirstEqual(vals2);
4961 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4964 int ival=-1; std::vector<int> ivval;
4965 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4966 std::vector<char> vals(sz);
4967 std::copy(pt,pt+sz,vals.begin());
4968 return self->findIdFirstEqualTuple(vals);
4971 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4974 int ival=-1; std::vector<int> ivval;
4975 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
4976 std::vector<char> vals(sz);
4977 std::copy(pt,pt+sz,vals.begin());
4978 return self->findIdSequence(vals);
4981 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4983 int sz=self->getNumberOfComponents();
4984 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4985 self->getTuple(tupleId,tmp);
4986 PyObject *ret=PyTuple_New(sz);
4987 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4991 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4994 int r1=(int)self->getMaxValue(tmp);
4995 PyObject *ret=PyTuple_New(2);
4996 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4997 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5001 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5004 int r1=(int)self->getMinValue(tmp);
5005 PyObject *ret=PyTuple_New(2);
5006 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5007 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5011 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5013 int nbOfCompo=self->getNumberOfComponents();
5018 if(PyInt_Check(obj))
5020 int val=(int)PyInt_AS_LONG(obj);
5021 return self->findIdFirstEqual(val);
5024 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5027 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5031 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5033 int nbOfCompo=self->getNumberOfComponents();
5040 if(PyInt_Check(obj))
5042 int val=(int)PyInt_AS_LONG(obj);
5043 return self->presenceOfValue(val);
5046 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5049 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5054 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5056 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5061 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5063 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5066 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5069 if(!self->isAllocated())
5070 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5071 PyObject *ret(PyTuple_New(1));
5072 PyObject *ret0(PyDict_New());
5073 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5074 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5075 PyObject *tmp1(PyInt_FromLong(0));
5076 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5077 PyTuple_SetItem(ret,0,ret0);
5081 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5085 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5087 self->checkAllocated();
5088 const char msg[]="Unexpected situation in __setitem__ !";
5089 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5092 std::vector<int> v1;
5094 DataArrayIntTuple *dd1=0;
5095 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5097 std::vector<int> vt1,vc1;
5098 std::pair<int, std::pair<int,int> > pt1,pc1;
5099 DataArrayInt *dt1=0,*dc1=0;
5100 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5101 MCAuto<DataArrayInt> tmp;
5109 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5112 throw INTERP_KERNEL::Exception(msg);
5121 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5124 throw INTERP_KERNEL::Exception(msg);
5133 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5136 throw INTERP_KERNEL::Exception(msg);
5145 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5148 throw INTERP_KERNEL::Exception(msg);
5157 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5160 throw INTERP_KERNEL::Exception(msg);
5169 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5172 throw INTERP_KERNEL::Exception(msg);
5181 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5184 throw INTERP_KERNEL::Exception(msg);
5193 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5196 throw INTERP_KERNEL::Exception(msg);
5205 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5208 throw INTERP_KERNEL::Exception(msg);
5217 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5220 throw INTERP_KERNEL::Exception(msg);
5229 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5232 throw INTERP_KERNEL::Exception(msg);
5241 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5244 throw INTERP_KERNEL::Exception(msg);
5253 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5256 throw INTERP_KERNEL::Exception(msg);
5265 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5268 throw INTERP_KERNEL::Exception(msg);
5277 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5280 throw INTERP_KERNEL::Exception(msg);
5289 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5292 throw INTERP_KERNEL::Exception(msg);
5297 throw INTERP_KERNEL::Exception(msg);
5304 class DataArrayByteTuple;
5306 class DataArrayByteIterator
5309 DataArrayByteIterator(DataArrayByte *da);
5310 ~DataArrayByteIterator();
5313 class DataArrayByteTuple
5316 std::string repr() const throw(INTERP_KERNEL::Exception);
5317 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5320 std::string __str__() const throw(INTERP_KERNEL::Exception)
5322 return self->repr();
5325 char __int__() const throw(INTERP_KERNEL::Exception)
5327 return self->byteValue();
5330 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5332 return self->buildDAByte(1,self->getNumberOfCompo());
5337 class DataArrayAsciiCharIterator;
5339 class DataArrayAsciiChar : public DataArrayChar
5342 static DataArrayAsciiChar *New();
5343 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5344 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5345 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5348 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5350 return DataArrayAsciiChar::New();
5353 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5355 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) !";
5356 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5360 if(PyInt_Check(nbOfTuples))
5362 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5364 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5367 if(PyInt_Check(nbOfComp))
5368 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5369 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5371 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5372 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5373 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5374 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5378 throw INTERP_KERNEL::Exception(msg);
5381 {//DataArrayAsciiChar.New([1,3,4],3)
5382 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5384 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5385 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5389 else if(PyString_Check(nbOfTuples))
5391 if(PyString_Size(nbOfTuples)!=1)
5392 throw INTERP_KERNEL::Exception(msg);
5393 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5394 std::vector<std::string> tmp;
5395 if(fillStringVector(elt0,tmp))
5396 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5398 throw INTERP_KERNEL::Exception(msg);
5401 throw INTERP_KERNEL::Exception(msg);
5405 std::vector<std::string> tmmp;
5406 if(fillStringVector(elt0,tmmp))
5407 //DataArrayAsciiChar.New(["abc","de","fghi"])
5408 return DataArrayAsciiChar::New(tmmp,' ');
5411 // DataArrayAsciiChar.New([1,3,4])
5412 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5413 int tmpp1=-1,tmpp2=-1;
5414 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5415 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5420 else if(PyInt_Check(elt0))
5422 int nbOfTuples1=PyInt_AS_LONG(elt0);
5424 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5429 if(PyInt_Check(nbOfTuples))
5430 {//DataArrayAsciiChar.New(5,2)
5431 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5433 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5434 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5435 ret->alloc(nbOfTuples1,nbOfCompo);
5439 throw INTERP_KERNEL::Exception(msg);
5442 throw INTERP_KERNEL::Exception(msg);
5445 {//DataArrayAsciiChar.New(5)
5446 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5447 ret->alloc(nbOfTuples1,1);
5452 throw INTERP_KERNEL::Exception(msg);
5455 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5457 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5460 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5462 std::ostringstream oss;
5463 self->reprQuickOverview(oss);
5467 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5469 return self->iterator();
5472 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5474 char tmp[2]; tmp[1]='\0';
5475 tmp[0]=self->getIJ(tupleId,compoId);
5476 return std::string(tmp);
5479 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5481 char tmp[2]; tmp[1]='\0';
5482 tmp[0]=self->getIJSafe(tupleId,compoId);
5483 return std::string(tmp);
5486 std::string __str__() const throw(INTERP_KERNEL::Exception)
5488 return self->repr();
5491 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5493 const char *vals=self->getConstPointer();
5494 int nbOfComp=self->getNumberOfComponents();
5495 int nbOfTuples=self->getNumberOfTuples();
5496 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5499 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5501 if(PyString_Check(tupl))
5503 Py_ssize_t sz=PyString_Size(tupl);
5504 std::vector<char> vals(sz);
5505 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5506 return self->presenceOfTuple(vals);
5509 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5512 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5514 if(PyString_Check(vals))
5516 Py_ssize_t sz=PyString_Size(vals);
5517 std::vector<char> vals2(sz);
5518 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5519 return self->presenceOfValue(vals2);
5522 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5525 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5527 if(PyString_Check(vals))
5529 Py_ssize_t sz=PyString_Size(vals);
5530 std::vector<char> vals2(sz);
5531 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5532 return self->findIdFirstEqual(vals2);
5535 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5538 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5540 if(PyString_Check(tupl))
5542 Py_ssize_t sz=PyString_Size(tupl);
5543 std::vector<char> vals(sz);
5544 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5545 return self->findIdFirstEqualTuple(vals);
5548 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5551 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5553 if(PyString_Check(strOrListOfInt))
5555 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5556 std::vector<char> vals(sz);
5557 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5558 return self->findIdSequence(vals);
5561 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5564 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5566 int sz=self->getNumberOfComponents();
5567 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5568 self->getTuple(tupleId,tmp);
5569 return PyString_FromString(tmp);
5572 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5575 char tmp2[2]; tmp2[1]='\0';
5576 tmp2[0]=self->getMaxValue(tmp);
5577 PyObject *ret=PyTuple_New(2);
5578 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5579 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5583 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5586 char tmp2[2]; tmp2[1]='\0';
5587 tmp2[0]=self->getMinValue(tmp);
5588 PyObject *ret=PyTuple_New(2);
5589 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5590 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5594 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5596 int nbOfCompo=self->getNumberOfComponents();
5601 if(PyString_Check(obj))
5603 Py_ssize_t sz=PyString_Size(obj);
5604 char *pt=PyString_AsString(obj);
5606 return self->findIdFirstEqual(pt[0]);
5608 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5611 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5614 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5618 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5620 int nbOfCompo=self->getNumberOfComponents();
5627 if(PyString_Check(obj))
5629 Py_ssize_t sz=PyString_Size(obj);
5630 char *pt=PyString_AsString(obj);
5632 return self->presenceOfValue(pt[0]);
5634 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5637 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5640 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5644 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5647 std::vector<int> stdvecTyyppArr;
5648 std::pair<int, std::pair<int,int> > sTyyppArr;
5649 MEDCoupling::DataArrayInt *daIntTyypp=0;
5650 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5654 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5656 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5658 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5660 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5662 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5666 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5668 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.";
5670 std::vector<int> stdvecTyyppArr;
5671 std::pair<int, std::pair<int,int> > sTyyppArr;
5672 MEDCoupling::DataArrayInt *daIntTyypp=0;
5673 int nbOfCompo=self->getNumberOfComponents();
5674 int nbOfTuples=self->getNumberOfTuples();
5675 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5677 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5678 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5687 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5693 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5694 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5697 //value vector<string>
5700 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5701 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5704 //value DataArrayChar
5707 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5711 throw INTERP_KERNEL::Exception(msg);
5715 {//obj list-tuple[int]
5721 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5727 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5728 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5731 //value vector<string>
5734 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5735 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5738 //value DataArrayChar
5741 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5745 throw INTERP_KERNEL::Exception(msg);
5756 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5762 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5763 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5766 //value vector<string>
5769 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5770 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5773 //value DataArrayChar
5776 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5780 throw INTERP_KERNEL::Exception(msg);
5791 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5797 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5798 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5801 //value vector<string>
5804 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5805 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5808 //value DataArrayChar
5811 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5815 throw INTERP_KERNEL::Exception(msg);
5820 throw INTERP_KERNEL::Exception(msg);
5826 class DataArrayAsciiCharTuple;
5828 class DataArrayAsciiCharIterator
5831 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5832 ~DataArrayAsciiCharIterator();
5837 DataArrayAsciiCharTuple *ret=self->nextt();
5839 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5842 PyErr_SetString(PyExc_StopIteration,"No more data.");
5849 class DataArrayAsciiCharTuple
5852 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5853 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5856 std::string __str__() const throw(INTERP_KERNEL::Exception)
5858 return self->repr();
5861 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5863 return self->buildDAAsciiChar(1,self->getNumberOfCompo());