1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
22 %typemap(out) MEDCoupling::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) MEDCoupling::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
45 %newobject MEDCoupling::DataArray::deepCopy;
46 %newobject MEDCoupling::DataArray::buildNewEmptyInstance;
47 %newobject MEDCoupling::DataArray::selectByTupleRanges;
48 %newobject MEDCoupling::DataArray::selectByTupleId;
49 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
50 %newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
51 %newobject MEDCoupling::DataArray::Aggregate;
52 %newobject MEDCoupling::DataArrayFloat::New;
53 %newobject MEDCoupling::DataArrayInt::New;
54 %newobject MEDCoupling::DataArrayInt::__iter__;
55 %newobject MEDCoupling::DataArrayInt::selectPartDef;
56 %newobject MEDCoupling::DataArrayInt::convertToDblArr;
57 %newobject MEDCoupling::DataArrayInt::convertToFloatArr;
58 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
59 %newobject MEDCoupling::DataArrayInt::subArray;
60 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
61 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
62 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
63 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
64 %newobject MEDCoupling::DataArrayInt::renumber;
65 %newobject MEDCoupling::DataArrayInt::renumberR;
66 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
67 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
68 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
69 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
70 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
71 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
72 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
73 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
74 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
75 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
76 %newobject MEDCoupling::DataArrayInt::negate;
77 %newobject MEDCoupling::DataArrayInt::computeAbs;
78 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
79 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
80 %newobject MEDCoupling::DataArrayInt::findIdsStricltyNegative;
81 %newobject MEDCoupling::DataArrayInt::Aggregate;
82 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
83 %newobject MEDCoupling::DataArrayInt::Meld;
84 %newobject MEDCoupling::DataArrayInt::Add;
85 %newobject MEDCoupling::DataArrayInt::Substract;
86 %newobject MEDCoupling::DataArrayInt::Multiply;
87 %newobject MEDCoupling::DataArrayInt::Divide;
88 %newobject MEDCoupling::DataArrayInt::Pow;
89 %newobject MEDCoupling::DataArrayInt::BuildUnion;
90 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
91 %newobject MEDCoupling::DataArrayInt::Range;
92 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
93 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
94 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
95 %newobject MEDCoupling::DataArrayInt::buildComplement;
96 %newobject MEDCoupling::DataArrayInt::buildUnion;
97 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
98 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
99 %newobject MEDCoupling::DataArrayInt::buildIntersection;
100 %newobject MEDCoupling::DataArrayInt::buildUnique;
101 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
102 %newobject MEDCoupling::DataArrayInt::fromLinkedListOfPairToList;
103 %newobject MEDCoupling::DataArrayInt::findIdsGreaterOrEqualTo;
104 %newobject MEDCoupling::DataArrayInt::findIdsGreaterThan;
105 %newobject MEDCoupling::DataArrayInt::findIdsLowerOrEqualTo;
106 %newobject MEDCoupling::DataArrayInt::findIdsLowerThan;
107 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
108 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
109 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
110 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
111 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
112 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
113 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
114 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
115 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
116 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
117 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
118 %newobject MEDCoupling::DataArrayInt::__neg__;
119 %newobject MEDCoupling::DataArrayInt::__add__;
120 %newobject MEDCoupling::DataArrayInt::__radd__;
121 %newobject MEDCoupling::DataArrayInt::__sub__;
122 %newobject MEDCoupling::DataArrayInt::__rsub__;
123 %newobject MEDCoupling::DataArrayInt::__mul__;
124 %newobject MEDCoupling::DataArrayInt::__rmul__;
125 %newobject MEDCoupling::DataArrayInt::__div__;
126 %newobject MEDCoupling::DataArrayInt::__rdiv__;
127 %newobject MEDCoupling::DataArrayInt::__mod__;
128 %newobject MEDCoupling::DataArrayInt::__rmod__;
129 %newobject MEDCoupling::DataArrayInt::__pow__;
130 %newobject MEDCoupling::DataArrayInt::__rpow__;
131 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
132 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
133 %newobject MEDCoupling::DataArrayChar::renumber;
134 %newobject MEDCoupling::DataArrayChar::renumberR;
135 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
136 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
137 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
138 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
139 %newobject MEDCoupling::DataArrayChar::Aggregate;
140 %newobject MEDCoupling::DataArrayChar::Meld;
141 %newobject MEDCoupling::DataArrayByte::New;
142 %newobject MEDCoupling::DataArrayByte::__iter__;
143 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
144 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
145 %newobject MEDCoupling::DataArrayChar::subArray;
146 %newobject MEDCoupling::DataArrayAsciiChar::New;
147 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
148 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
149 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
150 %newobject MEDCoupling::DataArrayDouble::New;
151 %newobject MEDCoupling::DataArrayDouble::__iter__;
152 %newobject MEDCoupling::DataArrayDouble::selectPartDef;
153 %newobject MEDCoupling::DataArrayDouble::convertToIntArr;
154 %newobject MEDCoupling::DataArrayDouble::convertToFloatArr;
155 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
156 %newobject MEDCoupling::DataArrayDouble::Aggregate;
157 %newobject MEDCoupling::DataArrayDouble::Meld;
158 %newobject MEDCoupling::DataArrayDouble::Dot;
159 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
160 %newobject MEDCoupling::DataArrayDouble::Add;
161 %newobject MEDCoupling::DataArrayDouble::Substract;
162 %newobject MEDCoupling::DataArrayDouble::Multiply;
163 %newobject MEDCoupling::DataArrayDouble::Divide;
164 %newobject MEDCoupling::DataArrayDouble::Pow;
165 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
166 %newobject MEDCoupling::DataArrayDouble::subArray;
167 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
168 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
169 %newobject MEDCoupling::DataArrayDouble::cumSum;
170 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
171 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
172 %newobject MEDCoupling::DataArrayDouble::negate;
173 %newobject MEDCoupling::DataArrayDouble::computeAbs;
174 %newobject MEDCoupling::DataArrayDouble::applyFunc;
175 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
176 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
177 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
178 %newobject MEDCoupling::DataArrayDouble::determinant;
179 %newobject MEDCoupling::DataArrayDouble::eigenValues;
180 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
181 %newobject MEDCoupling::DataArrayDouble::inverse;
182 %newobject MEDCoupling::DataArrayDouble::trace;
183 %newobject MEDCoupling::DataArrayDouble::deviator;
184 %newobject MEDCoupling::DataArrayDouble::magnitude;
185 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
186 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
187 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
188 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
189 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
190 %newobject MEDCoupling::DataArrayDouble::renumber;
191 %newobject MEDCoupling::DataArrayDouble::renumberR;
192 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
193 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
194 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
195 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
196 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
197 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
198 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
199 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
200 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
201 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
202 %newobject MEDCoupling::DataArrayDouble::cartesianize;
203 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
204 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
205 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
206 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
207 %newobject MEDCoupling::DataArrayDouble::__neg__;
208 %newobject MEDCoupling::DataArrayDouble::__radd__;
209 %newobject MEDCoupling::DataArrayDouble::__rsub__;
210 %newobject MEDCoupling::DataArrayDouble::__rmul__;
211 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
212 %newobject MEDCoupling::DataArrayDouble::__pow__;
213 %newobject MEDCoupling::DataArrayDouble::__rpow__;
214 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
216 %newobject MEDCoupling::PartDefinition::New;
217 %newobject MEDCoupling::PartDefinition::toDAI;
218 %newobject MEDCoupling::PartDefinition::__add__;
219 %newobject MEDCoupling::PartDefinition::composeWith;
220 %newobject MEDCoupling::PartDefinition::tryToSimplify;
221 %newobject MEDCoupling::DataArrayPartDefinition::New;
222 %newobject MEDCoupling::SlicePartDefinition::New;
225 %feature("unref") DataArray "$this->decrRef();"
226 %feature("unref") DataArrayDouble "$this->decrRef();"
227 %feature("unref") DataArrayInt "$this->decrRef();"
228 %feature("unref") DataArrayChar "$this->decrRef();"
229 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
230 %feature("unref") DataArrayByte "$this->decrRef();"
232 %feature("unref") PartDefinition "$this->decrRef();"
233 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
234 %feature("unref") SlicePartDefinition "$this->decrRef();"
236 namespace MEDCoupling
243 } MEDCouplingAxisType;
247 class PartDefinition : public RefCountObject, public TimeLabel
250 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
251 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
252 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
253 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
254 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
255 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
256 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
257 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
260 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
262 return (*self)+other;
265 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
268 bool ret0(self->isEqual(other,ret1));
269 PyObject *ret=PyTuple_New(2);
270 PyObject *ret0Py=ret0?Py_True:Py_False;
272 PyTuple_SetItem(ret,0,ret0Py);
273 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
277 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
279 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
283 virtual ~PartDefinition();
286 class DataArrayPartDefinition : public PartDefinition
289 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
292 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
294 return DataArrayPartDefinition::New(listOfIds);
297 std::string __str__() const throw(INTERP_KERNEL::Exception)
299 return self->getRepr();
302 std::string __repr__() const throw(INTERP_KERNEL::Exception)
304 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
305 oss << self->getRepr();
310 virtual ~DataArrayPartDefinition();
313 class SlicePartDefinition : public PartDefinition
316 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
317 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
320 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
322 return SlicePartDefinition::New(start,stop,step);
325 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
328 self->getSlice(a,b,c);
329 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
332 std::string __str__() const throw(INTERP_KERNEL::Exception)
334 return self->getRepr();
337 std::string __repr__() const throw(INTERP_KERNEL::Exception)
339 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
340 oss << self->getRepr();
345 virtual ~SlicePartDefinition();
348 class DataArray : public RefCountObject, public TimeLabel
351 void setName(const std::string& name);
352 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
353 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
354 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
355 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
356 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
357 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
358 std::string getName() const;
359 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
360 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
361 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
362 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
363 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
364 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
365 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
366 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
367 int getNumberOfComponents() const;
368 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
369 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
370 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
371 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
372 virtual void desallocate() throw(INTERP_KERNEL::Exception);
373 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
374 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
375 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
376 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
377 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
378 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
379 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
380 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
381 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
382 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
383 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
384 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
385 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
386 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
387 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
388 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
389 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
390 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
391 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
392 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
393 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
394 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
395 void updateTime() const;
398 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
400 const std::vector<std::string>& comps=self->getInfoOnComponents();
401 PyObject *ret=PyList_New((int)comps.size());
402 for(int i=0;i<(int)comps.size();i++)
403 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
407 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
409 std::vector<int> tmp;
410 convertPyToNewIntArr3(li,tmp);
411 self->copyPartOfStringInfoFrom(other,tmp);
414 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
416 std::vector<int> tmp;
417 convertPyToNewIntArr3(li,tmp);
418 self->copyPartOfStringInfoFrom2(tmp,other);
421 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
424 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
425 if (!SWIG_IsOK(res1))
428 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
429 if(size!=self->getNumberOfTuples())
431 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
433 self->renumberInPlace(tmp);
437 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
439 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
440 da2->checkAllocated();
441 int size=self->getNumberOfTuples();
442 if(size!=self->getNumberOfTuples())
444 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
446 self->renumberInPlace(da2->getConstPointer());
450 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
453 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
454 if (!SWIG_IsOK(res1))
457 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
458 if(size!=self->getNumberOfTuples())
460 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
462 self->renumberInPlaceR(tmp);
466 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
468 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
469 da2->checkAllocated();
470 int size=self->getNumberOfTuples();
471 if(size!=self->getNumberOfTuples())
473 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
475 self->renumberInPlaceR(da2->getConstPointer());
479 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
480 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
482 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
483 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
484 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
485 DataArrayInt *tuplesSelecPtr2=0;
488 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
490 throw INTERP_KERNEL::Exception(msg);
492 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
495 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
497 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
498 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
501 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
503 std::vector<std::pair<int,int> > ranges;
504 convertPyToVectorPairInt(li,ranges);
505 return self->selectByTupleRanges(ranges);
508 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
511 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
512 if (!SWIG_IsOK(res1))
515 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
516 return self->selectByTupleId(tmp,tmp+size);
520 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
522 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
523 da2->checkAllocated();
524 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
528 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
531 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
532 if (!SWIG_IsOK(res1))
535 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
536 return self->selectByTupleIdSafe(tmp,tmp+size);
540 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
542 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
543 da2->checkAllocated();
544 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
548 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
550 std::vector<int> tmp;
551 convertPyToNewIntArr3(li,tmp);
552 DataArray *ret=self->keepSelectedComponents(tmp);
553 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
556 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
558 if(!PySlice_Check(slic))
559 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
560 Py_ssize_t strt=2,stp=2,step=2;
561 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
562 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
564 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
565 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
568 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
570 if(!PySlice_Check(slic))
571 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
572 Py_ssize_t strt=2,stp=2,step=2;
573 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
574 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
576 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
577 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
580 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
582 if(!PySlice_Check(slic))
583 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
584 Py_ssize_t strt=2,stp=2,step=2;
585 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
586 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
587 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
590 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
592 if(!PySlice_Check(slic))
593 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
594 Py_ssize_t strt=2,stp=2,step=2;
595 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
596 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
597 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
600 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
602 std::vector<const DataArray *> tmp;
603 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
604 return DataArray::Aggregate(tmp);
607 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
609 if(!PySlice_Check(slic))
610 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
611 Py_ssize_t strt=2,stp=2,step=2;
612 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
613 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
614 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
617 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
619 if(!PySlice_Check(slic))
620 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
621 Py_ssize_t strt=2,stp=2,step=2;
622 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
623 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
624 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
627 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
629 PyObject *ret(PyTuple_New(2));
630 std::string a0(self->getName());
631 const std::vector<std::string> &a1(self->getInfoOnComponents());
632 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
635 PyObject *ret1(PyList_New(sz));
636 for(int i=0;i<sz;i++)
637 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
638 PyTuple_SetItem(ret,1,ret1);
643 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
645 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 !";
646 if(!PyTuple_Check(inp))
647 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
648 int sz(PyTuple_Size(inp));
650 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
651 PyObject *a0(PyTuple_GetItem(inp,0));
652 if(!PyString_Check(a0))
653 throw INTERP_KERNEL::Exception(MSG);
654 PyObject *a1(PyTuple_GetItem(inp,1));
655 std::vector<std::string> a1cpp;
656 if(!fillStringVector(a1,a1cpp))
657 throw INTERP_KERNEL::Exception(MSG);
658 self->setName(PyString_AsString(a0));
659 self->setInfoOnComponents(a1cpp);
664 class DataArrayFloat : public DataArray
667 static DataArrayFloat *New();
668 void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
669 bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
670 bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
671 bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
672 void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
673 void iota(float init=0.) throw(INTERP_KERNEL::Exception);
676 DataArrayFloat() throw(INTERP_KERNEL::Exception)
678 return DataArrayFloat::New();
681 static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
683 return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
686 DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
688 return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
691 std::string __repr__() const throw(INTERP_KERNEL::Exception)
693 std::ostringstream oss;
694 self->reprQuickOverview(oss);
698 std::string __str__() const throw(INTERP_KERNEL::Exception)
700 return self->reprNotTooLong();
703 int __len__() const throw(INTERP_KERNEL::Exception)
705 if(self->isAllocated())
707 return self->getNumberOfTuples();
711 throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
715 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
717 const float *vals(self->begin());
718 return convertDblArrToPyList<float>(vals,self->getNbOfElems());
721 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
723 const float *vals(self->begin());
724 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
725 return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
728 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
730 return DataArrayT__getitem<float>(self,obj);
733 DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
735 return DataArrayT__setitem__<float>(self,obj,value);
739 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
741 return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
749 class DataArrayDoubleIterator;
751 class DataArrayDouble : public DataArray
754 static DataArrayDouble *New();
755 double doubleValue() const throw(INTERP_KERNEL::Exception);
756 bool empty() const throw(INTERP_KERNEL::Exception);
757 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
758 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
759 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
760 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
761 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
762 double popBackSilent() throw(INTERP_KERNEL::Exception);
763 void pack() const throw(INTERP_KERNEL::Exception);
764 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
765 void fillWithZero() throw(INTERP_KERNEL::Exception);
766 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
767 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
768 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
769 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
770 void reverse() throw(INTERP_KERNEL::Exception);
771 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
772 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
773 std::string repr() const throw(INTERP_KERNEL::Exception);
774 std::string reprZip() const throw(INTERP_KERNEL::Exception);
775 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
776 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
777 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
778 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
779 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
780 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
781 void transpose() throw(INTERP_KERNEL::Exception);
782 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
783 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
784 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
785 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
786 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
787 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
788 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
789 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
790 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
791 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
792 double front() const throw(INTERP_KERNEL::Exception);
793 double back() const throw(INTERP_KERNEL::Exception);
794 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
795 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
796 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
797 double *getPointer() throw(INTERP_KERNEL::Exception);
798 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
799 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
800 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
801 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
802 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
803 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
804 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
805 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
806 double getAverageValue() const throw(INTERP_KERNEL::Exception);
807 double norm2() const throw(INTERP_KERNEL::Exception);
808 double normMax() const throw(INTERP_KERNEL::Exception);
809 double normMin() const throw(INTERP_KERNEL::Exception);
810 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
811 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
812 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
813 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
814 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
815 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
816 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
817 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
818 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
819 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
820 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
821 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
822 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
823 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
824 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
825 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
826 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
827 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
828 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
829 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
830 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
831 void abs() throw(INTERP_KERNEL::Exception);
832 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
833 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
834 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
835 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
836 void applyPow(double val) throw(INTERP_KERNEL::Exception);
837 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
838 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
839 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
840 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
841 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
842 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
843 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
844 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
845 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
846 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
847 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
848 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
849 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
850 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
851 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
852 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
853 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
854 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
855 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
856 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
857 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
858 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
859 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
860 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
861 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
862 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
863 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
864 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
867 DataArrayDouble() throw(INTERP_KERNEL::Exception)
869 return DataArrayDouble::New();
872 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
874 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
877 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
879 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
882 DataArrayDouble *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
884 MCAuto<DataArrayDouble> ret(self->selectPartDef(pd));
888 DataArrayDouble *cumSum() const throw(INTERP_KERNEL::Exception)
890 MCAuto<DataArrayDouble> ret(self->cumSum());
894 DataArrayFloat *convertToFloatArr() const throw(INTERP_KERNEL::Exception)
896 MCAuto<DataArrayFloat> ret(self->convertToFloatArr());
900 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception)
902 MCAuto<DataArrayInt> ret(self->convertToIntArr());
906 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
909 std::vector<double> bb;
911 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
912 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
913 self->pushBackValsSilent(tmp,tmp+nbTuples);
916 std::string __repr__() const throw(INTERP_KERNEL::Exception)
918 std::ostringstream oss;
919 self->reprQuickOverview(oss);
923 std::string __str__() const throw(INTERP_KERNEL::Exception)
925 return self->reprNotTooLong();
928 double __float__() const throw(INTERP_KERNEL::Exception)
930 return self->doubleValue();
933 int __len__() const throw(INTERP_KERNEL::Exception)
935 if(self->isAllocated())
937 return self->getNumberOfTuples();
941 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
945 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
947 return self->iterator();
950 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
952 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 !";
953 if(PyList_Check(li) || PyTuple_Check(li))
957 if(PyInt_Check(nbOfTuples))
959 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
961 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
964 if(PyInt_Check(nbOfComp))
965 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
966 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
968 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
969 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
970 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
973 throw INTERP_KERNEL::Exception(msg);
976 {//DataArrayDouble.setValues([1.,3.,4.],3)
978 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
979 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
983 throw INTERP_KERNEL::Exception(msg);
986 {// DataArrayDouble.setValues([1.,3.,4.])
987 int tmpp1=-1,tmpp2=-1;
988 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
989 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
993 throw INTERP_KERNEL::Exception(msg);
996 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
998 const double *vals(self->begin());
999 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
1003 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
1005 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1009 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1012 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1013 PyObject *ret=PyTuple_New(2);
1014 PyObject *ret0Py=ret0?Py_True:Py_False;
1016 PyTuple_SetItem(ret,0,ret0Py);
1017 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1021 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1023 const double *vals(self->begin());
1024 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1025 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1028 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1030 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1032 DataArrayDouble *a,*a2;
1033 DataArrayDoubleTuple *aa,*aa2;
1034 std::vector<double> bb,bb2;
1036 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1037 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1038 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1042 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1044 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1046 DataArrayDouble *a,*a2;
1047 DataArrayDoubleTuple *aa,*aa2;
1048 std::vector<double> bb,bb2;
1050 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1052 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1053 return convertDblArrToPyListOfTuple<double>(res,3,3);
1056 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1058 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1060 DataArrayDouble *a,*a2;
1061 DataArrayDoubleTuple *aa,*aa2;
1062 std::vector<double> bb,bb2;
1064 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1065 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1066 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1069 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1072 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1073 if (!SWIG_IsOK(res1))
1076 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1077 if(size!=self->getNumberOfTuples())
1079 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1081 return self->renumber(tmp);
1085 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1087 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1088 da2->checkAllocated();
1089 int size=self->getNumberOfTuples();
1090 if(size!=self->getNumberOfTuples())
1092 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1094 return self->renumber(da2->getConstPointer());
1098 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1101 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1102 if (!SWIG_IsOK(res1))
1105 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1106 if(size!=self->getNumberOfTuples())
1108 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1110 return self->renumberR(tmp);
1114 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1116 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1117 da2->checkAllocated();
1118 int size=self->getNumberOfTuples();
1119 if(size!=self->getNumberOfTuples())
1121 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1123 return self->renumberR(da2->getConstPointer());
1127 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1130 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1131 if (!SWIG_IsOK(res1))
1134 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1135 if(size!=self->getNumberOfTuples())
1137 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1139 return self->renumberAndReduce(tmp,newNbOfTuple);
1143 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1145 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1146 da2->checkAllocated();
1147 int size=self->getNumberOfTuples();
1148 if(size!=self->getNumberOfTuples())
1150 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1152 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1156 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1158 int thisTupleId,otherTupleId;
1159 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1160 PyObject *ret=PyTuple_New(3);
1161 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1162 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1163 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1167 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1170 double r1=self->getMaxValue(tmp);
1171 PyObject *ret=PyTuple_New(2);
1172 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1173 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1177 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1180 double r1=self->getMaxValue2(tmp);
1181 PyObject *ret=PyTuple_New(2);
1182 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1183 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1187 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1190 double r1=self->getMinValue(tmp);
1191 PyObject *ret=PyTuple_New(2);
1192 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1193 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1197 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1200 double r1=self->getMinValue2(tmp);
1201 PyObject *ret=PyTuple_New(2);
1202 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1203 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1207 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1209 int nbOfCompo(self->getNumberOfComponents());
1210 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1211 self->getMinMaxPerComponent(tmp);
1212 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1216 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1218 int sz=self->getNumberOfComponents();
1219 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1220 self->accumulate(tmp);
1221 return convertDblArrToPyList<double>(tmp,sz);
1224 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1227 std::vector<int> val2;
1228 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1229 return self->accumulatePerChunck(bg,bg+sz);
1232 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1234 DataArrayInt *comm, *commIndex;
1235 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1236 PyObject *res = PyList_New(2);
1237 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1238 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1242 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1246 DataArrayDoubleTuple *aa;
1247 std::vector<double> bb;
1249 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1250 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1252 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1253 PyObject *ret=PyTuple_New(2);
1254 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1255 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1259 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1261 std::vector<int> tmp;
1262 convertPyToNewIntArr3(li,tmp);
1263 self->setSelectedComponents(a,tmp);
1266 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1268 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1269 std::size_t sz(retCpp.size());
1270 PyObject *res(PyList_New(sz));
1271 for(std::size_t i=0;i<sz;i++)
1272 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1276 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1278 int sz=self->getNumberOfComponents();
1279 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1280 self->getTuple(tupleId,tmp);
1281 return convertDblArrToPyList<double>(tmp,sz);
1284 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1286 std::vector<const DataArrayDouble *> tmp;
1287 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1288 return DataArrayDouble::Aggregate(tmp);
1291 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1293 std::vector<const DataArrayDouble *> tmp;
1294 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1295 return DataArrayDouble::Meld(tmp);
1298 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1302 DataArrayDoubleTuple *aa;
1303 std::vector<double> bb;
1305 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1306 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1307 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1308 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1309 DataArrayInt *c=0,*cI=0;
1310 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1311 PyObject *ret=PyTuple_New(2);
1312 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1313 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1317 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1319 DataArrayInt *ret1=0;
1320 bool ret0=self->areIncludedInMe(other,prec,ret1);
1321 PyObject *ret=PyTuple_New(2);
1322 PyObject *ret0Py=ret0?Py_True:Py_False;
1324 PyTuple_SetItem(ret,0,ret0Py);
1325 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1329 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1331 return DataArrayT__getitem<double>(self,obj);
1334 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1336 return DataArrayT__setitem__<double>(self,obj,value);
1339 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1341 return self->negate();
1344 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1346 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1349 DataArrayDoubleTuple *aa;
1350 std::vector<double> bb;
1353 #ifndef WITHOUT_AUTOFIELD
1355 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1357 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1360 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1361 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1363 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1366 throw INTERP_KERNEL::Exception(msg);
1370 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1375 MCAuto<DataArrayDouble> ret=self->deepCopy();
1376 ret->applyLin(1.,val);
1377 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1381 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1385 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1386 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1390 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1391 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1394 throw INTERP_KERNEL::Exception(msg);
1398 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1400 const char msg[]="Unexpected situation in __radd__ !";
1403 DataArrayDoubleTuple *aa;
1404 std::vector<double> bb;
1406 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1411 MCAuto<DataArrayDouble> ret=self->deepCopy();
1412 ret->applyLin(1.,val);
1417 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1418 return DataArrayDouble::Add(self,aaa);
1422 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1423 return DataArrayDouble::Add(self,aaa);
1426 throw INTERP_KERNEL::Exception(msg);
1430 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1432 const char msg[]="Unexpected situation in __iadd__ !";
1435 DataArrayDoubleTuple *aa;
1436 std::vector<double> bb;
1438 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1443 self->applyLin(1.,val);
1444 Py_XINCREF(trueSelf);
1450 Py_XINCREF(trueSelf);
1455 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1456 self->addEqual(aaa);
1457 Py_XINCREF(trueSelf);
1462 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1463 self->addEqual(aaa);
1464 Py_XINCREF(trueSelf);
1468 throw INTERP_KERNEL::Exception(msg);
1472 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1474 const char msg[]="Unexpected situation in __sub__ !";
1477 DataArrayDoubleTuple *aa;
1478 std::vector<double> bb;
1481 #ifndef WITHOUT_AUTOFIELD
1483 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1485 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1488 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1489 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1491 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1494 throw INTERP_KERNEL::Exception(msg);
1498 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1503 MCAuto<DataArrayDouble> ret=self->deepCopy();
1504 ret->applyLin(1.,-val);
1505 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1509 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1513 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1514 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1518 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1519 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1522 throw INTERP_KERNEL::Exception(msg);
1526 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1528 const char msg[]="Unexpected situation in __rsub__ !";
1531 DataArrayDoubleTuple *aa;
1532 std::vector<double> bb;
1534 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1539 MCAuto<DataArrayDouble> ret=self->deepCopy();
1540 ret->applyLin(-1.,val);
1545 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1546 return DataArrayDouble::Substract(aaa,self);
1550 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1551 return DataArrayDouble::Substract(aaa,self);
1554 throw INTERP_KERNEL::Exception(msg);
1558 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1560 const char msg[]="Unexpected situation in __isub__ !";
1563 DataArrayDoubleTuple *aa;
1564 std::vector<double> bb;
1566 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1571 self->applyLin(1,-val);
1572 Py_XINCREF(trueSelf);
1577 self->substractEqual(a);
1578 Py_XINCREF(trueSelf);
1583 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1584 self->substractEqual(aaa);
1585 Py_XINCREF(trueSelf);
1590 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1591 self->substractEqual(aaa);
1592 Py_XINCREF(trueSelf);
1596 throw INTERP_KERNEL::Exception(msg);
1600 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1602 const char msg[]="Unexpected situation in __mul__ !";
1605 DataArrayDoubleTuple *aa;
1606 std::vector<double> bb;
1609 #ifndef WITHOUT_AUTOFIELD
1611 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1613 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1616 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1617 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1619 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1622 throw INTERP_KERNEL::Exception(msg);
1626 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1631 MCAuto<DataArrayDouble> ret=self->deepCopy();
1632 ret->applyLin(val,0.);
1633 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1637 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1641 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1642 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1646 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1647 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1650 throw INTERP_KERNEL::Exception(msg);
1654 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1656 const char msg[]="Unexpected situation in __rmul__ !";
1659 DataArrayDoubleTuple *aa;
1660 std::vector<double> bb;
1662 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1667 MCAuto<DataArrayDouble> ret=self->deepCopy();
1668 ret->applyLin(val,0.);
1673 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1674 return DataArrayDouble::Multiply(self,aaa);
1678 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1679 return DataArrayDouble::Multiply(self,aaa);
1682 throw INTERP_KERNEL::Exception(msg);
1686 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1688 const char msg[]="Unexpected situation in __imul__ !";
1691 DataArrayDoubleTuple *aa;
1692 std::vector<double> bb;
1694 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1699 self->applyLin(val,0.);
1700 Py_XINCREF(trueSelf);
1705 self->multiplyEqual(a);
1706 Py_XINCREF(trueSelf);
1711 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1712 self->multiplyEqual(aaa);
1713 Py_XINCREF(trueSelf);
1718 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1719 self->multiplyEqual(aaa);
1720 Py_XINCREF(trueSelf);
1724 throw INTERP_KERNEL::Exception(msg);
1728 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1730 const char msg[]="Unexpected situation in __div__ !";
1733 DataArrayDoubleTuple *aa;
1734 std::vector<double> bb;
1737 #ifndef WITHOUT_AUTOFIELD
1739 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1741 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1744 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1745 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1747 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1750 throw INTERP_KERNEL::Exception(msg);
1754 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1760 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1761 MCAuto<DataArrayDouble> ret=self->deepCopy();
1762 ret->applyLin(1/val,0.);
1763 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1767 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1771 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1772 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1776 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1777 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1780 throw INTERP_KERNEL::Exception(msg);
1784 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1786 const char msg[]="Unexpected situation in __rdiv__ !";
1789 DataArrayDoubleTuple *aa;
1790 std::vector<double> bb;
1792 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1797 MCAuto<DataArrayDouble> ret=self->deepCopy();
1803 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1804 return DataArrayDouble::Divide(aaa,self);
1808 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1809 return DataArrayDouble::Divide(aaa,self);
1812 throw INTERP_KERNEL::Exception(msg);
1816 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1818 const char msg[]="Unexpected situation in __idiv__ !";
1821 DataArrayDoubleTuple *aa;
1822 std::vector<double> bb;
1824 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1830 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1831 self->applyLin(1./val,0.);
1832 Py_XINCREF(trueSelf);
1837 self->divideEqual(a);
1838 Py_XINCREF(trueSelf);
1843 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1844 self->divideEqual(aaa);
1845 Py_XINCREF(trueSelf);
1850 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1851 self->divideEqual(aaa);
1852 Py_XINCREF(trueSelf);
1856 throw INTERP_KERNEL::Exception(msg);
1860 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1862 const char msg[]="Unexpected situation in __pow__ !";
1865 DataArrayDoubleTuple *aa;
1866 std::vector<double> bb;
1868 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1873 MCAuto<DataArrayDouble> ret=self->deepCopy();
1879 return DataArrayDouble::Pow(self,a);
1883 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1884 return DataArrayDouble::Pow(self,aaa);
1888 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1889 return DataArrayDouble::Pow(self,aaa);
1892 throw INTERP_KERNEL::Exception(msg);
1896 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1898 const char msg[]="Unexpected situation in __rpow__ !";
1901 DataArrayDoubleTuple *aa;
1902 std::vector<double> bb;
1904 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1909 MCAuto<DataArrayDouble> ret=self->deepCopy();
1910 ret->applyRPow(val);
1915 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1916 return DataArrayDouble::Pow(aaa,self);
1920 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1921 return DataArrayDouble::Pow(aaa,self);
1924 throw INTERP_KERNEL::Exception(msg);
1928 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1930 const char msg[]="Unexpected situation in __ipow__ !";
1933 DataArrayDoubleTuple *aa;
1934 std::vector<double> bb;
1936 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1941 self->applyPow(val);
1942 Py_XINCREF(trueSelf);
1948 Py_XINCREF(trueSelf);
1953 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1954 self->powEqual(aaa);
1955 Py_XINCREF(trueSelf);
1960 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1961 self->powEqual(aaa);
1962 Py_XINCREF(trueSelf);
1966 throw INTERP_KERNEL::Exception(msg);
1970 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1972 DataArrayInt *c=0,*cI=0;
1974 self->computeTupleIdsNearTuples(other,eps,c,cI);
1975 PyObject *ret=PyTuple_New(2);
1976 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1977 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1981 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1983 DataArrayInt *ret1=0;
1984 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1985 PyObject *ret=PyTuple_New(2);
1986 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1987 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1992 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
1994 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
1997 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2000 if(!self->isAllocated())
2001 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2002 PyObject *ret(PyTuple_New(1));
2003 PyObject *ret0(PyDict_New());
2004 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2005 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2006 PyObject *tmp1(PyInt_FromLong(0));
2007 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2008 PyTuple_SetItem(ret,0,ret0);
2012 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2018 class DataArrayDoubleTuple;
2020 class DataArrayDoubleIterator
2023 DataArrayDoubleIterator(DataArrayDouble *da);
2024 ~DataArrayDoubleIterator();
2029 DataArrayDoubleTuple *ret=self->nextt();
2031 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2034 PyErr_SetString(PyExc_StopIteration,"No more data.");
2041 class DataArrayDoubleTuple
2044 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2045 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2048 std::string __str__() const throw(INTERP_KERNEL::Exception)
2050 return self->repr();
2053 double __float__() const throw(INTERP_KERNEL::Exception)
2055 return self->doubleValue();
2058 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2060 return self->buildDADouble(1,self->getNumberOfCompo());
2063 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2065 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2066 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2067 Py_XINCREF(trueSelf);
2071 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2073 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2074 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2075 Py_XINCREF(trueSelf);
2079 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2081 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2082 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2083 Py_XINCREF(trueSelf);
2087 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2089 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2090 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2091 Py_XINCREF(trueSelf);
2095 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2097 return PyInt_FromLong(self->getNumberOfCompo());
2100 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2102 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2105 std::vector<int> multiVal;
2106 std::pair<int, std::pair<int,int> > slic;
2107 MEDCoupling::DataArrayInt *daIntTyypp=0;
2108 const double *pt=self->getConstPointer();
2109 int nbc=self->getNumberOfCompo();
2110 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2117 std::ostringstream oss;
2118 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2119 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2123 return PyFloat_FromDouble(pt[singleVal]);
2127 return PyFloat_FromDouble(pt[nbc+singleVal]);
2130 std::ostringstream oss;
2131 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2132 throw INTERP_KERNEL::Exception(oss.str().c_str());
2138 PyObject *t=PyTuple_New(multiVal.size());
2139 for(int j=0;j<(int)multiVal.size();j++)
2141 int cid=multiVal[j];
2144 std::ostringstream oss;
2145 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2146 throw INTERP_KERNEL::Exception(oss.str().c_str());
2148 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2154 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2155 PyObject *t=PyTuple_New(sz);
2156 for(int j=0;j<sz;j++)
2157 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2161 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2165 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2167 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2168 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2171 std::vector<double> multiValV;
2172 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2173 int nbc=self->getNumberOfCompo();
2174 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2176 std::vector<int> multiVal;
2177 std::pair<int, std::pair<int,int> > slic;
2178 MEDCoupling::DataArrayInt *daIntTyypp=0;
2179 double *pt=self->getPointer();
2180 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2187 std::ostringstream oss;
2188 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2189 throw INTERP_KERNEL::Exception(oss.str().c_str());
2195 pt[singleVal]=singleValV;
2200 if(multiValV.size()!=1)
2202 std::ostringstream oss;
2203 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2204 throw INTERP_KERNEL::Exception(oss.str().c_str());
2206 pt[singleVal]=multiValV[0];
2211 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2215 throw INTERP_KERNEL::Exception(msg);
2224 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2228 std::ostringstream oss;
2229 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2230 throw INTERP_KERNEL::Exception(oss.str().c_str());
2238 if(multiVal.size()!=multiValV.size())
2240 std::ostringstream oss;
2241 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2242 throw INTERP_KERNEL::Exception(oss.str().c_str());
2244 for(int i=0;i<(int)multiVal.size();i++)
2246 int pos=multiVal[i];
2249 std::ostringstream oss;
2250 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2251 throw INTERP_KERNEL::Exception(oss.str().c_str());
2253 pt[multiVal[i]]=multiValV[i];
2259 const double *ptV=daIntTyyppV->getConstPointer();
2260 if(nbc>daIntTyyppV->getNumberOfCompo())
2262 std::ostringstream oss;
2263 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2264 throw INTERP_KERNEL::Exception(oss.str().c_str());
2266 std::copy(ptV,ptV+nbc,pt);
2270 throw INTERP_KERNEL::Exception(msg);
2275 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2280 for(int j=0;j<sz;j++)
2281 pt[slic.first+j*slic.second.second]=singleValV;
2286 if(sz!=(int)multiValV.size())
2288 std::ostringstream oss;
2289 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2290 throw INTERP_KERNEL::Exception(oss.str().c_str());
2292 for(int j=0;j<sz;j++)
2293 pt[slic.first+j*slic.second.second]=multiValV[j];
2298 const double *ptV=daIntTyyppV->getConstPointer();
2299 if(sz>daIntTyyppV->getNumberOfCompo())
2301 std::ostringstream oss;
2302 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2303 throw INTERP_KERNEL::Exception(oss.str().c_str());
2305 for(int j=0;j<sz;j++)
2306 pt[slic.first+j*slic.second.second]=ptV[j];
2310 throw INTERP_KERNEL::Exception(msg);
2314 throw INTERP_KERNEL::Exception(msg);
2320 class DataArrayIntIterator;
2322 class DataArrayInt : public DataArray
2325 static DataArrayInt *New();
2326 int intValue() const throw(INTERP_KERNEL::Exception);
2327 int getHashCode() const throw(INTERP_KERNEL::Exception);
2328 bool empty() const throw(INTERP_KERNEL::Exception);
2329 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2330 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2331 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2332 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2333 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2334 int popBackSilent() throw(INTERP_KERNEL::Exception);
2335 void pack() const throw(INTERP_KERNEL::Exception);
2336 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2337 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2338 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2339 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2340 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2341 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2342 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2343 void reverse() throw(INTERP_KERNEL::Exception);
2344 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2345 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2346 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2347 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2348 void fillWithZero() throw(INTERP_KERNEL::Exception);
2349 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2350 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2351 std::string repr() const throw(INTERP_KERNEL::Exception);
2352 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2353 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2354 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2355 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2356 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2357 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2358 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2359 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2360 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2361 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2362 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2363 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2364 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2365 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2366 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2367 void transpose() throw(INTERP_KERNEL::Exception);
2368 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2369 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2370 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2371 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2372 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2373 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2374 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2375 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2376 int front() const throw(INTERP_KERNEL::Exception);
2377 int back() const throw(INTERP_KERNEL::Exception);
2378 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2379 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2380 int *getPointer() throw(INTERP_KERNEL::Exception);
2381 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2382 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2383 const int *begin() const throw(INTERP_KERNEL::Exception);
2384 const int *end() const throw(INTERP_KERNEL::Exception);
2385 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2386 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2387 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2388 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2389 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2390 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2391 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2392 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2393 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2394 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2395 int count(int value) const throw(INTERP_KERNEL::Exception);
2396 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2397 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2398 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2399 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2400 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2401 void abs() throw(INTERP_KERNEL::Exception);
2402 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2403 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2404 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2405 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2406 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2407 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2408 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2409 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2410 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2411 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2412 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2413 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2414 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2415 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2416 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2417 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2418 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2419 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2420 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2421 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2422 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2423 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2424 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2425 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2426 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2427 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2428 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2429 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2430 void computeOffsets() throw(INTERP_KERNEL::Exception);
2431 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2432 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2433 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2434 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2435 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2436 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2437 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2438 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2439 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2440 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2441 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2442 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2443 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2444 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2445 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2446 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2447 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2448 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2449 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2451 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2454 DataArrayInt() throw(INTERP_KERNEL::Exception)
2456 return DataArrayInt::New();
2459 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2461 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)";
2462 std::string msg(msgBase);
2464 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2467 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2471 if(PyInt_Check(nbOfTuples))
2473 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2475 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2478 if(PyInt_Check(nbOfComp))
2479 {//DataArrayInt.New([1,3,4,5],2,2)
2480 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2482 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2483 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2484 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2485 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2489 throw INTERP_KERNEL::Exception(msg.c_str());
2492 {//DataArrayInt.New([1,3,4],3)
2493 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2495 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2496 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2501 throw INTERP_KERNEL::Exception(msg.c_str());
2504 {// DataArrayInt.New([1,3,4])
2505 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2506 int tmpp1=-1,tmpp2=-1;
2507 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2508 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2512 else if(PyInt_Check(elt0))
2514 int nbOfTuples1=PyInt_AS_LONG(elt0);
2516 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2521 if(PyInt_Check(nbOfTuples))
2522 {//DataArrayInt.New(5,2)
2523 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2525 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2526 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2527 ret->alloc(nbOfTuples1,nbOfCompo);
2531 throw INTERP_KERNEL::Exception(msg.c_str());
2534 throw INTERP_KERNEL::Exception(msg.c_str());
2537 {//DataArrayInt.New(5)
2538 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2539 ret->alloc(nbOfTuples1,1);
2544 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2545 {//DataArrayInt.New(numpyArray)
2546 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2550 throw INTERP_KERNEL::Exception(msg.c_str());
2551 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2554 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2556 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2559 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception)
2561 MCAuto<DataArrayDouble> ret(self->convertToDblArr());
2565 DataArrayFloat *convertToFloatArr() const throw(INTERP_KERNEL::Exception)
2567 MCAuto<DataArrayFloat> ret(self->convertToFloatArr());
2571 std::string __str__() const throw(INTERP_KERNEL::Exception)
2573 return self->reprNotTooLong();
2576 int __len__() const throw(INTERP_KERNEL::Exception)
2578 if(self->isAllocated())
2580 return self->getNumberOfTuples();
2584 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2588 int __int__() const throw(INTERP_KERNEL::Exception)
2590 return self->intValue();
2593 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2595 return self->iterator();
2598 DataArrayInt *fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception)
2600 MCAuto<DataArrayInt> ret(self->fromLinkedListOfPairToList());
2604 DataArrayInt *findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
2606 MCAuto<DataArrayInt> ret(self->findIdsGreaterOrEqualTo(val));
2610 DataArrayInt *findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception)
2612 MCAuto<DataArrayInt> ret(self->findIdsGreaterThan(val));
2616 DataArrayInt *findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
2618 MCAuto<DataArrayInt> ret(self->findIdsLowerOrEqualTo(val));
2622 DataArrayInt *findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception)
2624 MCAuto<DataArrayInt> ret(self->findIdsLowerThan(val));
2628 DataArrayInt *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
2630 MCAuto<DataArrayInt> ret(self->selectPartDef(pd));
2634 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2636 int sz=self->getNumberOfComponents();
2637 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2638 self->accumulate(tmp);
2639 return convertIntArrToPyList(tmp,sz);
2642 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2645 std::vector<int> val2;
2646 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2647 return self->accumulatePerChunck(bg,bg+sz);
2650 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2653 std::vector<int> val2;
2654 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2655 return self->findIdsEqualTuple(bg,bg+sz);
2658 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2660 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2661 PyObject *ret=PyList_New(slcs.size());
2662 for(std::size_t i=0;i<slcs.size();i++)
2663 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2667 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2669 if(!PySlice_Check(slic))
2670 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2671 Py_ssize_t strt=2,stp=2,step=2;
2672 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2673 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2674 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2675 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 !");
2676 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2679 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2682 self->getMinMaxValues(a,b);
2683 PyObject *ret=PyTuple_New(2);
2684 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2685 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2689 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2691 int newNbOfTuples=-1;
2692 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2693 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2694 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2695 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2696 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2697 PyObject *ret=PyTuple_New(2);
2698 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2699 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2703 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2705 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2706 int szArr,sw,iTypppArr;
2707 std::vector<int> stdvecTyyppArr;
2708 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2709 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2710 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2714 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2716 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 !";
2717 if(PyList_Check(li) || PyTuple_Check(li))
2719 if(nbOfTuples && nbOfTuples != Py_None)
2721 if(PyInt_Check(nbOfTuples))
2723 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2725 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2726 if(nbOfComp && nbOfComp != Py_None)
2728 if(PyInt_Check(nbOfComp))
2729 {//DataArrayInt.setValues([1,3,4,5],2,2)
2730 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2732 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2733 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2734 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2737 throw INTERP_KERNEL::Exception(msg);
2740 {//DataArrayInt.setValues([1,3,4],3)
2742 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2743 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2747 throw INTERP_KERNEL::Exception(msg);
2750 {// DataArrayInt.setValues([1,3,4])
2751 int tmpp1=-1,tmpp2=-1;
2752 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2753 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2757 throw INTERP_KERNEL::Exception(msg);
2760 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2762 const int *vals=self->getConstPointer();
2763 return convertIntArrToPyList(vals,self->getNbOfElems());
2767 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2769 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2773 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2776 bool ret0=self->isEqualIfNotWhy(other,ret1);
2777 PyObject *ret=PyTuple_New(2);
2778 PyObject *ret0Py=ret0?Py_True:Py_False;
2780 PyTuple_SetItem(ret,0,ret0Py);
2781 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2785 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2787 const int *vals=self->getConstPointer();
2788 int nbOfComp=self->getNumberOfComponents();
2789 int nbOfTuples=self->getNumberOfTuples();
2790 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2793 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2795 std::vector<const DataArrayInt *> groups;
2796 std::vector< std::vector<int> > fidsOfGroups;
2797 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2798 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2799 PyObject *ret = PyList_New(2);
2800 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2801 int sz=fidsOfGroups.size();
2802 PyObject *ret1 = PyList_New(sz);
2803 for(int i=0;i<sz;i++)
2804 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2805 PyList_SetItem(ret,1,ret1);
2809 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2812 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2813 if (!SWIG_IsOK(res1))
2816 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2817 self->transformWithIndArr(tmp,tmp+size);
2821 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2822 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2826 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2830 std::vector<int> multiVal;
2831 std::pair<int, std::pair<int,int> > slic;
2832 MEDCoupling::DataArrayInt *daIntTyypp=0;
2833 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2837 return self->findIdsEqualList(&singleVal,&singleVal+1);
2839 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2841 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2843 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2847 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2851 std::vector<int> multiVal;
2852 std::pair<int, std::pair<int,int> > slic;
2853 MEDCoupling::DataArrayInt *daIntTyypp=0;
2854 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2858 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2860 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2862 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2864 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2868 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2870 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2872 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2873 if (!SWIG_IsOK(res1))
2876 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2877 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2881 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2883 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2884 da2->checkAllocated();
2885 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2887 PyObject *ret = PyList_New(3);
2888 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2889 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2890 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2894 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2897 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2898 if (!SWIG_IsOK(res1))
2901 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2902 return self->transformWithIndArrR(tmp,tmp+size);
2906 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2907 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2911 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2914 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2915 if (!SWIG_IsOK(res1))
2918 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2919 if(size!=self->getNumberOfTuples())
2921 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2923 return self->renumberAndReduce(tmp,newNbOfTuple);
2927 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2929 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2930 da2->checkAllocated();
2931 int size=self->getNumberOfTuples();
2932 if(size!=self->getNumberOfTuples())
2934 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2936 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2940 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2943 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2944 if (!SWIG_IsOK(res1))
2947 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2948 if(size!=self->getNumberOfTuples())
2950 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2952 return self->renumber(tmp);
2956 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2958 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2959 da2->checkAllocated();
2960 int size=self->getNumberOfTuples();
2961 if(size!=self->getNumberOfTuples())
2963 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2965 return self->renumber(da2->getConstPointer());
2969 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2972 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2973 if (!SWIG_IsOK(res1))
2976 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2977 if(size!=self->getNumberOfTuples())
2979 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2981 return self->renumberR(tmp);
2985 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2987 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2988 da2->checkAllocated();
2989 int size=self->getNumberOfTuples();
2990 if(size!=self->getNumberOfTuples())
2992 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2994 return self->renumberR(da2->getConstPointer());
2998 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3000 std::vector<int> tmp;
3001 convertPyToNewIntArr3(li,tmp);
3002 self->setSelectedComponents(a,tmp);
3005 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
3007 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
3008 std::size_t sz(retCpp.size());
3009 PyObject *res(PyList_New(sz));
3010 for(std::size_t i=0;i<sz;i++)
3011 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3015 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3017 int sz=self->getNumberOfComponents();
3018 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3019 self->getTuple(tupleId,tmp);
3020 return convertIntArrToPyList(tmp,sz);
3023 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3025 DataArrayInt *arr=0;
3026 DataArrayInt *arrI=0;
3027 self->changeSurjectiveFormat(targetNb,arr,arrI);
3028 PyObject *res = PyList_New(2);
3029 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3030 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3034 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3036 std::vector<const DataArrayInt *> tmp;
3037 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3038 return DataArrayInt::Meld(tmp);
3041 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3043 std::vector<const DataArrayInt *> tmp;
3044 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3045 return DataArrayInt::Aggregate(tmp);
3048 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3050 std::vector<const DataArrayInt *> tmp;
3051 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3052 return DataArrayInt::AggregateIndexes(tmp);
3055 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3057 std::vector<const DataArrayInt *> tmp;
3058 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3059 return DataArrayInt::BuildUnion(tmp);
3062 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3064 std::vector<const DataArrayInt *> tmp;
3065 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3066 return DataArrayInt::BuildIntersection(tmp);
3069 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3072 int r1=self->getMaxValue(tmp);
3073 PyObject *ret=PyTuple_New(2);
3074 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3075 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3079 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3082 int r1=self->getMinValue(tmp);
3083 PyObject *ret=PyTuple_New(2);
3084 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3085 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3089 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3091 int nbOfCompo=self->getNumberOfComponents();
3096 if(PyInt_Check(obj))
3098 int val=(int)PyInt_AS_LONG(obj);
3099 return self->findIdFirstEqual(val);
3102 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3106 std::vector<int> arr;
3107 convertPyToNewIntArr3(obj,arr);
3108 return self->findIdFirstEqualTuple(arr);
3113 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3115 int nbOfCompo=self->getNumberOfComponents();
3122 if(PyInt_Check(obj))
3124 int val=(int)PyInt_AS_LONG(obj);
3125 return self->presenceOfValue(val);
3128 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3132 std::vector<int> arr;
3133 convertPyToNewIntArr3(obj,arr);
3134 return self->presenceOfTuple(arr);
3139 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3141 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3142 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3143 self->checkAllocated();
3144 int nbOfTuples=self->getNumberOfTuples();
3145 int nbOfComponents=self->getNumberOfComponents();
3147 std::vector<int> vt1,vc1;
3148 std::pair<int, std::pair<int,int> > pt1,pc1;
3149 DataArrayInt *dt1=0,*dc1=0;
3151 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3152 MCAuto<DataArrayInt> ret;
3157 if(nbOfComponents==1)
3158 return PyInt_FromLong(self->getIJSafe(it1,0));
3159 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3162 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3164 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3166 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3168 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3171 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3172 std::vector<int> v2(1,ic1);
3173 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3177 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3178 std::vector<int> v2(1,ic1);
3179 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3183 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3184 std::vector<int> v2(1,ic1);
3185 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3189 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3190 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3194 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3195 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3199 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3200 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3204 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3205 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3209 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3210 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3211 std::vector<int> v2(nbOfComp);
3212 for(int i=0;i<nbOfComp;i++)
3213 v2[i]=pc1.first+i*pc1.second.second;
3214 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3218 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3219 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3220 std::vector<int> v2(nbOfComp);
3221 for(int i=0;i<nbOfComp;i++)
3222 v2[i]=pc1.first+i*pc1.second.second;
3223 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3227 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3228 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3229 std::vector<int> v2(nbOfComp);
3230 for(int i=0;i<nbOfComp;i++)
3231 v2[i]=pc1.first+i*pc1.second.second;
3232 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3236 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3237 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3238 std::vector<int> v2(nbOfComp);
3239 for(int i=0;i<nbOfComp;i++)
3240 v2[i]=pc1.first+i*pc1.second.second;
3241 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3244 throw INTERP_KERNEL::Exception(msg);
3248 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3250 self->checkAllocated();
3251 const char msg[]="Unexpected situation in __setitem__ !";
3252 int nbOfTuples=self->getNumberOfTuples();
3253 int nbOfComponents=self->getNumberOfComponents();
3256 std::vector<int> v1;
3258 DataArrayIntTuple *dd1=0;
3259 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3261 std::vector<int> vt1,vc1;
3262 std::pair<int, std::pair<int,int> > pt1,pc1;
3263 DataArrayInt *dt1=0,*dc1=0;
3264 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3265 MCAuto<DataArrayInt> tmp;
3273 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3276 tmp=DataArrayInt::New();
3277 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3278 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3281 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3284 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3285 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3288 throw INTERP_KERNEL::Exception(msg);
3297 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3300 tmp=DataArrayInt::New();
3301 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3302 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3305 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3308 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3309 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3312 throw INTERP_KERNEL::Exception(msg);
3321 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3324 tmp=DataArrayInt::New();
3325 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3326 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3329 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3332 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3333 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3336 throw INTERP_KERNEL::Exception(msg);
3345 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3348 tmp=DataArrayInt::New();
3349 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3350 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3353 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3356 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3357 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3360 throw INTERP_KERNEL::Exception(msg);
3369 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3372 tmp=DataArrayInt::New();
3373 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3374 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3377 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3380 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3381 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3384 throw INTERP_KERNEL::Exception(msg);
3393 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3396 tmp=DataArrayInt::New();
3397 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3398 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3401 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3404 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3405 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3408 throw INTERP_KERNEL::Exception(msg);
3417 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3420 tmp=DataArrayInt::New();
3421 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3422 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3425 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3428 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3429 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3432 throw INTERP_KERNEL::Exception(msg);
3441 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3444 tmp=DataArrayInt::New();
3445 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3446 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3449 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3452 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3453 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3456 throw INTERP_KERNEL::Exception(msg);
3465 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3468 tmp=DataArrayInt::New();
3469 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3470 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3473 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3476 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3477 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3480 throw INTERP_KERNEL::Exception(msg);
3489 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3492 tmp=DataArrayInt::New();
3493 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3494 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3497 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3500 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3501 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3504 throw INTERP_KERNEL::Exception(msg);
3513 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3516 tmp=DataArrayInt::New();
3517 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3518 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3521 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3524 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3525 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3528 throw INTERP_KERNEL::Exception(msg);
3537 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3540 tmp=DataArrayInt::New();
3541 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3542 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3545 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3548 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3549 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3552 throw INTERP_KERNEL::Exception(msg);
3561 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3564 tmp=DataArrayInt::New();
3565 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3566 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3569 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3572 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3573 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3576 throw INTERP_KERNEL::Exception(msg);
3585 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3588 tmp=DataArrayInt::New();
3589 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3590 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3593 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3596 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3597 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3600 throw INTERP_KERNEL::Exception(msg);
3609 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3612 tmp=DataArrayInt::New();
3613 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3614 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3617 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3620 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3621 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3624 throw INTERP_KERNEL::Exception(msg);
3633 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3636 tmp=DataArrayInt::New();
3637 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3638 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3641 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3644 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3645 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3648 throw INTERP_KERNEL::Exception(msg);
3653 throw INTERP_KERNEL::Exception(msg);
3658 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3660 return self->negate();
3663 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3665 const char msg[]="Unexpected situation in __add__ !";
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::Add(self,aaaa);
3687 return DataArrayInt::Add(self,a);
3691 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3692 return DataArrayInt::Add(self,aaaa);
3695 throw INTERP_KERNEL::Exception(msg);
3699 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3701 const char msg[]="Unexpected situation in __radd__ !";
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::Add(self,aaaa);
3723 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3724 return DataArrayInt::Add(self,aaaa);
3727 throw INTERP_KERNEL::Exception(msg);
3731 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3733 const char msg[]="Unexpected situation in __iadd__ !";
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());
3752 Py_XINCREF(trueSelf);
3758 Py_XINCREF(trueSelf);
3763 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3764 self->addEqual(aaaa);
3765 Py_XINCREF(trueSelf);
3769 throw INTERP_KERNEL::Exception(msg);
3773 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3775 const char msg[]="Unexpected situation in __sub__ !";
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(1,-val);
3792 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3793 return DataArrayInt::Substract(self,aaaa);
3797 return DataArrayInt::Substract(self,a);
3801 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3802 return DataArrayInt::Substract(self,aaaa);
3805 throw INTERP_KERNEL::Exception(msg);
3809 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3811 const char msg[]="Unexpected situation in __rsub__ !";
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(-1,val);
3828 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3829 return DataArrayInt::Substract(aaaa,self);
3833 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3834 return DataArrayInt::Substract(aaaa,self);
3837 throw INTERP_KERNEL::Exception(msg);
3841 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3843 const char msg[]="Unexpected situation in __isub__ !";
3846 std::vector<int> aa;
3847 DataArrayIntTuple *aaa;
3849 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3854 self->applyLin(1,-val);
3855 Py_XINCREF(trueSelf);
3860 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3861 self->substractEqual(bb);
3862 Py_XINCREF(trueSelf);
3867 self->substractEqual(a);
3868 Py_XINCREF(trueSelf);
3873 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3874 self->substractEqual(aaaa);
3875 Py_XINCREF(trueSelf);
3879 throw INTERP_KERNEL::Exception(msg);
3883 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3885 const char msg[]="Unexpected situation in __mul__ !";
3888 std::vector<int> aa;
3889 DataArrayIntTuple *aaa;
3891 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3896 MCAuto<DataArrayInt> ret=self->deepCopy();
3897 ret->applyLin(val,0);
3902 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3903 return DataArrayInt::Multiply(self,aaaa);
3907 return DataArrayInt::Multiply(self,a);
3911 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3912 return DataArrayInt::Multiply(self,aaaa);
3915 throw INTERP_KERNEL::Exception(msg);
3919 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3921 const char msg[]="Unexpected situation in __rmul__ !";
3924 std::vector<int> aa;
3925 DataArrayIntTuple *aaa;
3927 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3932 MCAuto<DataArrayInt> ret=self->deepCopy();
3933 ret->applyLin(val,0);
3938 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3939 return DataArrayInt::Multiply(self,aaaa);
3943 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3944 return DataArrayInt::Multiply(self,aaaa);
3947 throw INTERP_KERNEL::Exception(msg);
3951 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3953 const char msg[]="Unexpected situation in __imul__ !";
3956 std::vector<int> aa;
3957 DataArrayIntTuple *aaa;
3959 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3964 self->applyLin(val,0);
3965 Py_XINCREF(trueSelf);
3970 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3971 self->multiplyEqual(bb);
3972 Py_XINCREF(trueSelf);
3977 self->multiplyEqual(a);
3978 Py_XINCREF(trueSelf);
3983 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3984 self->multiplyEqual(aaaa);
3985 Py_XINCREF(trueSelf);
3989 throw INTERP_KERNEL::Exception(msg);
3993 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3995 const char msg[]="Unexpected situation in __div__ !";
3998 std::vector<int> aa;
3999 DataArrayIntTuple *aaa;
4001 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4006 MCAuto<DataArrayInt> ret=self->deepCopy();
4007 ret->applyDivideBy(val);
4012 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4013 return DataArrayInt::Divide(self,aaaa);
4017 return DataArrayInt::Divide(self,a);
4021 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4022 return DataArrayInt::Divide(self,aaaa);
4025 throw INTERP_KERNEL::Exception(msg);
4029 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4031 const char msg[]="Unexpected situation in __rdiv__ !";
4034 std::vector<int> aa;
4035 DataArrayIntTuple *aaa;
4037 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4042 MCAuto<DataArrayInt> ret=self->deepCopy();
4048 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4049 return DataArrayInt::Divide(aaaa,self);
4053 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4054 return DataArrayInt::Divide(aaaa,self);
4057 throw INTERP_KERNEL::Exception(msg);
4061 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4063 const char msg[]="Unexpected situation in __idiv__ !";
4066 std::vector<int> aa;
4067 DataArrayIntTuple *aaa;
4069 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4074 self->applyDivideBy(val);
4075 Py_XINCREF(trueSelf);
4080 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4081 self->divideEqual(bb);
4082 Py_XINCREF(trueSelf);
4087 self->divideEqual(a);
4088 Py_XINCREF(trueSelf);
4093 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4094 self->divideEqual(aaaa);
4095 Py_XINCREF(trueSelf);
4099 throw INTERP_KERNEL::Exception(msg);
4103 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4105 const char msg[]="Unexpected situation in __mod__ !";
4108 std::vector<int> aa;
4109 DataArrayIntTuple *aaa;
4111 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4116 MCAuto<DataArrayInt> ret=self->deepCopy();
4117 ret->applyModulus(val);
4122 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4123 return DataArrayInt::Modulus(self,aaaa);
4127 return DataArrayInt::Modulus(self,a);
4131 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4132 return DataArrayInt::Modulus(self,aaaa);
4135 throw INTERP_KERNEL::Exception(msg);
4139 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4141 const char msg[]="Unexpected situation in __rmod__ !";
4144 std::vector<int> aa;
4145 DataArrayIntTuple *aaa;
4147 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4152 MCAuto<DataArrayInt> ret=self->deepCopy();
4153 ret->applyRModulus(val);
4158 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4159 return DataArrayInt::Modulus(aaaa,self);
4163 return DataArrayInt::Modulus(a,self);
4167 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4168 return DataArrayInt::Modulus(aaaa,self);
4171 throw INTERP_KERNEL::Exception(msg);
4175 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4177 const char msg[]="Unexpected situation in __imod__ !";
4180 std::vector<int> aa;
4181 DataArrayIntTuple *aaa;
4183 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4188 self->applyModulus(val);
4189 Py_XINCREF(trueSelf);
4194 self->modulusEqual(a);
4195 Py_XINCREF(trueSelf);
4200 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4201 self->modulusEqual(aaaa);
4202 Py_XINCREF(trueSelf);
4206 throw INTERP_KERNEL::Exception(msg);
4210 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4212 const char msg[]="Unexpected situation in __pow__ !";
4215 std::vector<int> aa;
4216 DataArrayIntTuple *aaa;
4218 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4223 MCAuto<DataArrayInt> ret=self->deepCopy();
4229 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4230 return DataArrayInt::Pow(self,aaaa);
4234 return DataArrayInt::Pow(self,a);
4238 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4239 return DataArrayInt::Pow(self,aaaa);
4242 throw INTERP_KERNEL::Exception(msg);
4246 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4248 const char msg[]="Unexpected situation in __rpow__ !";
4251 std::vector<int> aa;
4252 DataArrayIntTuple *aaa;
4254 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4259 MCAuto<DataArrayInt> ret=self->deepCopy();
4260 ret->applyRPow(val);
4265 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4266 return DataArrayInt::Pow(aaaa,self);
4270 return DataArrayInt::Pow(a,self);
4274 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4275 return DataArrayInt::Pow(aaaa,self);
4278 throw INTERP_KERNEL::Exception(msg);
4282 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4284 const char msg[]="Unexpected situation in __ipow__ !";
4287 std::vector<int> aa;
4288 DataArrayIntTuple *aaa;
4290 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4295 self->applyPow(val);
4296 Py_XINCREF(trueSelf);
4302 Py_XINCREF(trueSelf);
4307 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4308 self->powEqual(aaaa);
4309 Py_XINCREF(trueSelf);
4313 throw INTERP_KERNEL::Exception(msg);
4317 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4319 std::ostringstream oss;
4320 self->reprQuickOverview(oss);
4324 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4326 int szArr,sw,iTypppArr;
4327 std::vector<int> stdvecTyyppArr;
4328 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4329 self->pushBackValsSilent(tmp,tmp+szArr);
4332 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4334 std::vector<int> ret1;
4335 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4336 std::size_t sz=ret0.size();
4337 PyObject *pyRet=PyTuple_New(2);
4338 PyObject *pyRet0=PyList_New((int)sz);
4339 PyObject *pyRet1=PyList_New((int)sz);
4340 for(std::size_t i=0;i<sz;i++)
4342 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4343 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4345 PyTuple_SetItem(pyRet,0,pyRet0);
4346 PyTuple_SetItem(pyRet,1,pyRet1);
4350 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4352 DataArrayInt *ret0=0,*ret1=0;
4353 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4354 PyObject *pyRet=PyTuple_New(2);
4355 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4356 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4360 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4363 bool ret(self->isRange(a,b,c));
4364 PyObject *pyRet=PyTuple_New(2);
4365 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4367 PyTuple_SetItem(pyRet,0,ret0Py);
4369 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4375 PyTuple_SetItem(pyRet,1,ret1Py);
4380 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4382 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4385 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4388 if(!self->isAllocated())
4389 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4390 PyObject *ret(PyTuple_New(1));
4391 PyObject *ret0(PyDict_New());
4392 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4393 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4394 PyObject *tmp1(PyInt_FromLong(0));
4395 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4396 PyTuple_SetItem(ret,0,ret0);
4400 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4406 class DataArrayIntTuple;
4408 class DataArrayIntIterator
4411 DataArrayIntIterator(DataArrayInt *da);
4412 ~DataArrayIntIterator();
4417 DataArrayIntTuple *ret=self->nextt();
4419 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4422 PyErr_SetString(PyExc_StopIteration,"No more data.");
4429 class DataArrayIntTuple
4432 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4433 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4436 std::string __str__() const throw(INTERP_KERNEL::Exception)
4438 return self->repr();
4441 int __int__() const throw(INTERP_KERNEL::Exception)
4443 return self->intValue();
4446 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4448 return self->buildDAInt(1,self->getNumberOfCompo());
4451 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4453 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4454 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4455 Py_XINCREF(trueSelf);
4459 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4461 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4462 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4463 Py_XINCREF(trueSelf);
4467 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4469 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4470 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4471 Py_XINCREF(trueSelf);
4475 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4477 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4478 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4479 Py_XINCREF(trueSelf);
4483 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4485 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4486 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4487 Py_XINCREF(trueSelf);
4491 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4493 return PyInt_FromLong(self->getNumberOfCompo());
4496 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4498 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4501 std::vector<int> multiVal;
4502 std::pair<int, std::pair<int,int> > slic;
4503 MEDCoupling::DataArrayInt *daIntTyypp=0;
4504 const int *pt=self->getConstPointer();
4505 int nbc=self->getNumberOfCompo();
4506 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4513 std::ostringstream oss;
4514 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4515 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4519 return PyInt_FromLong(pt[singleVal]);
4523 return PyInt_FromLong(pt[nbc+singleVal]);
4526 std::ostringstream oss;
4527 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4528 throw INTERP_KERNEL::Exception(oss.str().c_str());
4534 PyObject *t=PyTuple_New(multiVal.size());
4535 for(int j=0;j<(int)multiVal.size();j++)
4537 int cid=multiVal[j];
4540 std::ostringstream oss;
4541 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4542 throw INTERP_KERNEL::Exception(oss.str().c_str());
4544 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4550 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4551 PyObject *t=PyTuple_New(sz);
4552 for(int j=0;j<sz;j++)
4553 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4557 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4561 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4563 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4564 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4567 std::vector<int> multiValV;
4568 std::pair<int, std::pair<int,int> > slicV;
4569 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4570 int nbc=self->getNumberOfCompo();
4571 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4573 std::vector<int> multiVal;
4574 std::pair<int, std::pair<int,int> > slic;
4575 MEDCoupling::DataArrayInt *daIntTyypp=0;
4576 int *pt=self->getPointer();
4577 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4584 std::ostringstream oss;
4585 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4586 throw INTERP_KERNEL::Exception(oss.str().c_str());
4592 pt[singleVal]=singleValV;
4597 if(multiValV.size()!=1)
4599 std::ostringstream oss;
4600 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4601 throw INTERP_KERNEL::Exception(oss.str().c_str());
4603 pt[singleVal]=multiValV[0];
4608 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4612 throw INTERP_KERNEL::Exception(msg);
4621 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4625 std::ostringstream oss;
4626 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4627 throw INTERP_KERNEL::Exception(oss.str().c_str());
4635 if(multiVal.size()!=multiValV.size())
4637 std::ostringstream oss;
4638 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4639 throw INTERP_KERNEL::Exception(oss.str().c_str());
4641 for(int i=0;i<(int)multiVal.size();i++)
4643 int pos=multiVal[i];
4646 std::ostringstream oss;
4647 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4648 throw INTERP_KERNEL::Exception(oss.str().c_str());
4650 pt[multiVal[i]]=multiValV[i];
4656 const int *ptV=daIntTyyppV->getConstPointer();
4657 if(nbc>daIntTyyppV->getNumberOfCompo())
4659 std::ostringstream oss;
4660 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4661 throw INTERP_KERNEL::Exception(oss.str().c_str());
4663 std::copy(ptV,ptV+nbc,pt);
4667 throw INTERP_KERNEL::Exception(msg);
4672 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4677 for(int j=0;j<sz;j++)
4678 pt[slic.first+j*slic.second.second]=singleValV;
4683 if(sz!=(int)multiValV.size())
4685 std::ostringstream oss;
4686 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4687 throw INTERP_KERNEL::Exception(oss.str().c_str());
4689 for(int j=0;j<sz;j++)
4690 pt[slic.first+j*slic.second.second]=multiValV[j];
4695 const int *ptV=daIntTyyppV->getConstPointer();
4696 if(sz>daIntTyyppV->getNumberOfCompo())
4698 std::ostringstream oss;
4699 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4700 throw INTERP_KERNEL::Exception(oss.str().c_str());
4702 for(int j=0;j<sz;j++)
4703 pt[slic.first+j*slic.second.second]=ptV[j];
4707 throw INTERP_KERNEL::Exception(msg);
4711 throw INTERP_KERNEL::Exception(msg);
4717 class DataArrayChar : public DataArray
4720 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4721 int getHashCode() const throw(INTERP_KERNEL::Exception);
4722 bool empty() const throw(INTERP_KERNEL::Exception);
4723 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4724 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4725 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4726 char popBackSilent() throw(INTERP_KERNEL::Exception);
4727 void pack() const throw(INTERP_KERNEL::Exception);
4728 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4729 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4730 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4731 void reverse() throw(INTERP_KERNEL::Exception);
4732 void fillWithZero() throw(INTERP_KERNEL::Exception);
4733 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4734 std::string repr() const throw(INTERP_KERNEL::Exception);
4735 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4736 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4737 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4738 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4739 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4740 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4741 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4742 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4743 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4744 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4745 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4746 char front() const throw(INTERP_KERNEL::Exception);
4747 char back() const throw(INTERP_KERNEL::Exception);
4748 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4749 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4750 char *getPointer() throw(INTERP_KERNEL::Exception);
4751 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4752 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4753 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4754 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4755 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4756 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4757 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4758 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4759 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4760 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4761 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4764 int __len__() const throw(INTERP_KERNEL::Exception)
4766 if(self->isAllocated())
4768 return self->getNumberOfTuples();
4772 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4776 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4779 bool ret0=self->isEqualIfNotWhy(other,ret1);
4780 PyObject *ret=PyTuple_New(2);
4781 PyObject *ret0Py=ret0?Py_True:Py_False;
4783 PyTuple_SetItem(ret,0,ret0Py);
4784 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4788 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4791 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4792 if (!SWIG_IsOK(res1))
4795 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4796 if(size!=self->getNumberOfTuples())
4798 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4800 return self->renumber(tmp);
4804 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4806 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4807 da2->checkAllocated();
4808 int size=self->getNumberOfTuples();
4809 if(size!=self->getNumberOfTuples())
4811 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4813 return self->renumber(da2->getConstPointer());
4817 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4820 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4821 if (!SWIG_IsOK(res1))
4824 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4825 if(size!=self->getNumberOfTuples())
4827 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4829 return self->renumberR(tmp);
4833 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4835 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4836 da2->checkAllocated();
4837 int size=self->getNumberOfTuples();
4838 if(size!=self->getNumberOfTuples())
4840 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4842 return self->renumberR(da2->getConstPointer());
4846 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4849 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4850 if (!SWIG_IsOK(res1))
4853 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4854 if(size!=self->getNumberOfTuples())
4856 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4858 return self->renumberAndReduce(tmp,newNbOfTuple);
4862 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4864 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4865 da2->checkAllocated();
4866 int size=self->getNumberOfTuples();
4867 if(size!=self->getNumberOfTuples())
4869 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4871 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4875 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4877 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4878 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4879 return DataArrayChar::Aggregate(tmp);
4882 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4884 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4885 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4886 return DataArrayChar::Meld(tmp);
4891 class DataArrayByteIterator;
4893 class DataArrayByte : public DataArrayChar
4896 static DataArrayByte *New();
4897 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4898 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4899 char byteValue() const throw(INTERP_KERNEL::Exception);
4902 DataArrayByte() throw(INTERP_KERNEL::Exception)
4904 return DataArrayByte::New();
4907 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4909 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) !";
4910 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4914 if(PyInt_Check(nbOfTuples))
4916 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4918 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4921 if(PyInt_Check(nbOfComp))
4922 {//DataArrayByte.New([1,3,4,5],2,2)
4923 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4925 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4926 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4927 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4928 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4932 throw INTERP_KERNEL::Exception(msg);
4935 {//DataArrayByte.New([1,3,4],3)
4936 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4938 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4939 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4944 throw INTERP_KERNEL::Exception(msg);
4947 {// DataArrayByte.New([1,3,4])
4948 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4949 int tmpp1=-1,tmpp2=-1;
4950 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4951 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4955 else if(PyInt_Check(elt0))
4957 int nbOfTuples1=PyInt_AS_LONG(elt0);
4959 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4964 if(PyInt_Check(nbOfTuples))
4965 {//DataArrayByte.New(5,2)
4966 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4968 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4969 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4970 ret->alloc(nbOfTuples1,nbOfCompo);
4974 throw INTERP_KERNEL::Exception(msg);
4977 throw INTERP_KERNEL::Exception(msg);
4980 {//DataArrayByte.New(5)
4981 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4982 ret->alloc(nbOfTuples1,1);
4987 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4988 {//DataArrayDouble.New(numpyArray)
4989 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4993 throw INTERP_KERNEL::Exception(msg);
4996 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4998 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5001 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5003 std::ostringstream oss;
5004 self->reprQuickOverview(oss);
5008 int __int__() const throw(INTERP_KERNEL::Exception)
5010 return (int) self->byteValue();
5013 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5015 return self->iterator();
5018 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5020 return (int)self->getIJ(tupleId,compoId);
5023 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5025 return (int)self->getIJSafe(tupleId,compoId);
5028 std::string __str__() const throw(INTERP_KERNEL::Exception)
5030 return self->repr();
5033 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5035 const char *vals=self->getConstPointer();
5036 int nbOfComp=self->getNumberOfComponents();
5037 int nbOfTuples=self->getNumberOfTuples();
5038 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5041 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5044 int ival=-1; std::vector<int> ivval;
5045 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
5046 std::vector<char> vals(sz);
5047 std::copy(pt,pt+sz,vals.begin());
5048 return self->presenceOfTuple(vals);
5051 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5054 int ival=-1; std::vector<int> ivval;
5055 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
5056 std::vector<char> vals2(sz);
5057 std::copy(pt,pt+sz,vals2.begin());
5058 return self->presenceOfValue(vals2);
5061 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5064 int ival=-1; std::vector<int> ivval;
5065 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
5066 std::vector<char> vals2(sz);
5067 std::copy(pt,pt+sz,vals2.begin());
5068 return self->findIdFirstEqual(vals2);
5071 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5074 int ival=-1; std::vector<int> ivval;
5075 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
5076 std::vector<char> vals(sz);
5077 std::copy(pt,pt+sz,vals.begin());
5078 return self->findIdFirstEqualTuple(vals);
5081 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5084 int ival=-1; std::vector<int> ivval;
5085 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
5086 std::vector<char> vals(sz);
5087 std::copy(pt,pt+sz,vals.begin());
5088 return self->findIdSequence(vals);
5091 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5093 int sz=self->getNumberOfComponents();
5094 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5095 self->getTuple(tupleId,tmp);
5096 PyObject *ret=PyTuple_New(sz);
5097 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5101 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5104 int r1=(int)self->getMaxValue(tmp);
5105 PyObject *ret=PyTuple_New(2);
5106 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5107 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5111 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5114 int r1=(int)self->getMinValue(tmp);
5115 PyObject *ret=PyTuple_New(2);
5116 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5117 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5121 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5123 int nbOfCompo=self->getNumberOfComponents();
5128 if(PyInt_Check(obj))
5130 int val=(int)PyInt_AS_LONG(obj);
5131 return self->findIdFirstEqual(val);
5134 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5137 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5141 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5143 int nbOfCompo=self->getNumberOfComponents();
5150 if(PyInt_Check(obj))
5152 int val=(int)PyInt_AS_LONG(obj);
5153 return self->presenceOfValue(val);
5156 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5159 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5164 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5166 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5171 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5173 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5176 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5179 if(!self->isAllocated())
5180 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5181 PyObject *ret(PyTuple_New(1));
5182 PyObject *ret0(PyDict_New());
5183 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5184 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5185 PyObject *tmp1(PyInt_FromLong(0));
5186 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5187 PyTuple_SetItem(ret,0,ret0);
5191 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5195 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5197 self->checkAllocated();
5198 const char msg[]="Unexpected situation in __setitem__ !";
5199 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5202 std::vector<int> v1;
5204 DataArrayIntTuple *dd1=0;
5205 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5207 std::vector<int> vt1,vc1;
5208 std::pair<int, std::pair<int,int> > pt1,pc1;
5209 DataArrayInt *dt1=0,*dc1=0;
5210 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5211 MCAuto<DataArrayInt> tmp;
5219 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5222 throw INTERP_KERNEL::Exception(msg);
5231 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5234 throw INTERP_KERNEL::Exception(msg);
5243 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5246 throw INTERP_KERNEL::Exception(msg);
5255 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5258 throw INTERP_KERNEL::Exception(msg);
5267 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5270 throw INTERP_KERNEL::Exception(msg);
5279 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5282 throw INTERP_KERNEL::Exception(msg);
5291 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5294 throw INTERP_KERNEL::Exception(msg);
5303 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5306 throw INTERP_KERNEL::Exception(msg);
5315 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5318 throw INTERP_KERNEL::Exception(msg);
5327 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5330 throw INTERP_KERNEL::Exception(msg);
5339 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5342 throw INTERP_KERNEL::Exception(msg);
5351 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5354 throw INTERP_KERNEL::Exception(msg);
5363 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5366 throw INTERP_KERNEL::Exception(msg);
5375 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5378 throw INTERP_KERNEL::Exception(msg);
5387 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5390 throw INTERP_KERNEL::Exception(msg);
5399 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5402 throw INTERP_KERNEL::Exception(msg);
5407 throw INTERP_KERNEL::Exception(msg);
5414 class DataArrayByteTuple;
5416 class DataArrayByteIterator
5419 DataArrayByteIterator(DataArrayByte *da);
5420 ~DataArrayByteIterator();
5423 class DataArrayByteTuple
5426 std::string repr() const throw(INTERP_KERNEL::Exception);
5427 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5430 std::string __str__() const throw(INTERP_KERNEL::Exception)
5432 return self->repr();
5435 char __int__() const throw(INTERP_KERNEL::Exception)
5437 return self->byteValue();
5440 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5442 return self->buildDAByte(1,self->getNumberOfCompo());
5447 class DataArrayAsciiCharIterator;
5449 class DataArrayAsciiChar : public DataArrayChar
5452 static DataArrayAsciiChar *New();
5453 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5454 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5455 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5458 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5460 return DataArrayAsciiChar::New();
5463 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5465 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) !";
5466 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5470 if(PyInt_Check(nbOfTuples))
5472 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5474 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5477 if(PyInt_Check(nbOfComp))
5478 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5479 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5481 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5482 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5483 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5484 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5488 throw INTERP_KERNEL::Exception(msg);
5491 {//DataArrayAsciiChar.New([1,3,4],3)
5492 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5494 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5495 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5499 else if(PyString_Check(nbOfTuples))
5501 if(PyString_Size(nbOfTuples)!=1)
5502 throw INTERP_KERNEL::Exception(msg);
5503 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5504 std::vector<std::string> tmp;
5505 if(fillStringVector(elt0,tmp))
5506 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5508 throw INTERP_KERNEL::Exception(msg);
5511 throw INTERP_KERNEL::Exception(msg);
5515 std::vector<std::string> tmmp;
5516 if(fillStringVector(elt0,tmmp))
5517 //DataArrayAsciiChar.New(["abc","de","fghi"])
5518 return DataArrayAsciiChar::New(tmmp,' ');
5521 // DataArrayAsciiChar.New([1,3,4])
5522 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5523 int tmpp1=-1,tmpp2=-1;
5524 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5525 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5530 else if(PyInt_Check(elt0))
5532 int nbOfTuples1=PyInt_AS_LONG(elt0);
5534 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5539 if(PyInt_Check(nbOfTuples))
5540 {//DataArrayAsciiChar.New(5,2)
5541 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5543 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5544 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5545 ret->alloc(nbOfTuples1,nbOfCompo);
5549 throw INTERP_KERNEL::Exception(msg);
5552 throw INTERP_KERNEL::Exception(msg);
5555 {//DataArrayAsciiChar.New(5)
5556 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5557 ret->alloc(nbOfTuples1,1);
5562 throw INTERP_KERNEL::Exception(msg);
5565 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5567 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5570 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5572 std::ostringstream oss;
5573 self->reprQuickOverview(oss);
5577 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5579 return self->iterator();
5582 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5584 char tmp[2]; tmp[1]='\0';
5585 tmp[0]=self->getIJ(tupleId,compoId);
5586 return std::string(tmp);
5589 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5591 char tmp[2]; tmp[1]='\0';
5592 tmp[0]=self->getIJSafe(tupleId,compoId);
5593 return std::string(tmp);
5596 std::string __str__() const throw(INTERP_KERNEL::Exception)
5598 return self->repr();
5601 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5603 const char *vals=self->getConstPointer();
5604 int nbOfComp=self->getNumberOfComponents();
5605 int nbOfTuples=self->getNumberOfTuples();
5606 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5609 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5611 if(PyString_Check(tupl))
5613 Py_ssize_t sz=PyString_Size(tupl);
5614 std::vector<char> vals(sz);
5615 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5616 return self->presenceOfTuple(vals);
5619 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5622 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5624 if(PyString_Check(vals))
5626 Py_ssize_t sz=PyString_Size(vals);
5627 std::vector<char> vals2(sz);
5628 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5629 return self->presenceOfValue(vals2);
5632 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5635 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5637 if(PyString_Check(vals))
5639 Py_ssize_t sz=PyString_Size(vals);
5640 std::vector<char> vals2(sz);
5641 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5642 return self->findIdFirstEqual(vals2);
5645 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5648 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5650 if(PyString_Check(tupl))
5652 Py_ssize_t sz=PyString_Size(tupl);
5653 std::vector<char> vals(sz);
5654 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5655 return self->findIdFirstEqualTuple(vals);
5658 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5661 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5663 if(PyString_Check(strOrListOfInt))
5665 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5666 std::vector<char> vals(sz);
5667 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5668 return self->findIdSequence(vals);
5671 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5674 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5676 int sz=self->getNumberOfComponents();
5677 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5678 self->getTuple(tupleId,tmp);
5679 return PyString_FromString(tmp);
5682 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5685 char tmp2[2]; tmp2[1]='\0';
5686 tmp2[0]=self->getMaxValue(tmp);
5687 PyObject *ret=PyTuple_New(2);
5688 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5689 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5693 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5696 char tmp2[2]; tmp2[1]='\0';
5697 tmp2[0]=self->getMinValue(tmp);
5698 PyObject *ret=PyTuple_New(2);
5699 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5700 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5704 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5706 int nbOfCompo=self->getNumberOfComponents();
5711 if(PyString_Check(obj))
5713 Py_ssize_t sz=PyString_Size(obj);
5714 char *pt=PyString_AsString(obj);
5716 return self->findIdFirstEqual(pt[0]);
5718 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5721 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5724 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5728 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5730 int nbOfCompo=self->getNumberOfComponents();
5737 if(PyString_Check(obj))
5739 Py_ssize_t sz=PyString_Size(obj);
5740 char *pt=PyString_AsString(obj);
5742 return self->presenceOfValue(pt[0]);
5744 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5747 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5750 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5754 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5757 std::vector<int> stdvecTyyppArr;
5758 std::pair<int, std::pair<int,int> > sTyyppArr;
5759 MEDCoupling::DataArrayInt *daIntTyypp=0;
5760 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5764 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5766 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5768 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5770 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5772 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5776 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5778 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.";
5780 std::vector<int> stdvecTyyppArr;
5781 std::pair<int, std::pair<int,int> > sTyyppArr;
5782 MEDCoupling::DataArrayInt *daIntTyypp=0;
5783 int nbOfCompo=self->getNumberOfComponents();
5784 int nbOfTuples=self->getNumberOfTuples();
5785 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5787 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5788 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5797 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5803 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5804 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5807 //value vector<string>
5810 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5811 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5814 //value DataArrayChar
5817 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5821 throw INTERP_KERNEL::Exception(msg);
5825 {//obj list-tuple[int]
5831 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5837 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5838 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5841 //value vector<string>
5844 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5845 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5848 //value DataArrayChar
5851 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5855 throw INTERP_KERNEL::Exception(msg);
5866 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5872 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5873 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5876 //value vector<string>
5879 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5880 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5883 //value DataArrayChar
5886 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5890 throw INTERP_KERNEL::Exception(msg);
5901 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5907 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5908 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5911 //value vector<string>
5914 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5915 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5918 //value DataArrayChar
5921 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5925 throw INTERP_KERNEL::Exception(msg);
5930 throw INTERP_KERNEL::Exception(msg);
5936 class DataArrayAsciiCharTuple;
5938 class DataArrayAsciiCharIterator
5941 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5942 ~DataArrayAsciiCharIterator();
5947 DataArrayAsciiCharTuple *ret=self->nextt();
5949 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5952 PyErr_SetString(PyExc_StopIteration,"No more data.");
5959 class DataArrayAsciiCharTuple
5962 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5963 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5966 std::string __str__() const throw(INTERP_KERNEL::Exception)
5968 return self->repr();
5971 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5973 return self->buildDAAsciiChar(1,self->getNumberOfCompo());