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::DataArrayInt::New;
53 %newobject MEDCoupling::DataArrayInt::__iter__;
54 %newobject MEDCoupling::DataArrayInt::selectPartDef;
55 %newobject MEDCoupling::DataArrayInt::convertToDblArr;
56 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
57 %newobject MEDCoupling::DataArrayInt::subArray;
58 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
59 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
60 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
61 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
62 %newobject MEDCoupling::DataArrayInt::renumber;
63 %newobject MEDCoupling::DataArrayInt::renumberR;
64 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
65 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
66 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
67 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
68 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
69 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
70 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
71 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
72 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
73 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
74 %newobject MEDCoupling::DataArrayInt::negate;
75 %newobject MEDCoupling::DataArrayInt::computeAbs;
76 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
77 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
78 %newobject MEDCoupling::DataArrayInt::findIdsStricltyNegative;
79 %newobject MEDCoupling::DataArrayInt::Aggregate;
80 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
81 %newobject MEDCoupling::DataArrayInt::Meld;
82 %newobject MEDCoupling::DataArrayInt::Add;
83 %newobject MEDCoupling::DataArrayInt::Substract;
84 %newobject MEDCoupling::DataArrayInt::Multiply;
85 %newobject MEDCoupling::DataArrayInt::Divide;
86 %newobject MEDCoupling::DataArrayInt::Pow;
87 %newobject MEDCoupling::DataArrayInt::BuildUnion;
88 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
89 %newobject MEDCoupling::DataArrayInt::Range;
90 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
91 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
92 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
93 %newobject MEDCoupling::DataArrayInt::buildComplement;
94 %newobject MEDCoupling::DataArrayInt::buildUnion;
95 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
96 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
97 %newobject MEDCoupling::DataArrayInt::buildIntersection;
98 %newobject MEDCoupling::DataArrayInt::buildUnique;
99 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
100 %newobject MEDCoupling::DataArrayInt::fromLinkedListOfPairToList;
101 %newobject MEDCoupling::DataArrayInt::findIdsGreaterOrEqualTo;
102 %newobject MEDCoupling::DataArrayInt::findIdsGreaterThan;
103 %newobject MEDCoupling::DataArrayInt::findIdsLowerOrEqualTo;
104 %newobject MEDCoupling::DataArrayInt::findIdsLowerThan;
105 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
106 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
107 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
108 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
109 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
110 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
111 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
112 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
113 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
114 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
115 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
116 %newobject MEDCoupling::DataArrayInt::__neg__;
117 %newobject MEDCoupling::DataArrayInt::__add__;
118 %newobject MEDCoupling::DataArrayInt::__radd__;
119 %newobject MEDCoupling::DataArrayInt::__sub__;
120 %newobject MEDCoupling::DataArrayInt::__rsub__;
121 %newobject MEDCoupling::DataArrayInt::__mul__;
122 %newobject MEDCoupling::DataArrayInt::__rmul__;
123 %newobject MEDCoupling::DataArrayInt::__div__;
124 %newobject MEDCoupling::DataArrayInt::__rdiv__;
125 %newobject MEDCoupling::DataArrayInt::__mod__;
126 %newobject MEDCoupling::DataArrayInt::__rmod__;
127 %newobject MEDCoupling::DataArrayInt::__pow__;
128 %newobject MEDCoupling::DataArrayInt::__rpow__;
129 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
130 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
131 %newobject MEDCoupling::DataArrayChar::renumber;
132 %newobject MEDCoupling::DataArrayChar::renumberR;
133 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
134 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
135 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
136 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
137 %newobject MEDCoupling::DataArrayChar::Aggregate;
138 %newobject MEDCoupling::DataArrayChar::Meld;
139 %newobject MEDCoupling::DataArrayByte::New;
140 %newobject MEDCoupling::DataArrayByte::__iter__;
141 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
142 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
143 %newobject MEDCoupling::DataArrayChar::subArray;
144 %newobject MEDCoupling::DataArrayAsciiChar::New;
145 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
146 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
147 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
148 %newobject MEDCoupling::DataArrayDouble::New;
149 %newobject MEDCoupling::DataArrayDouble::__iter__;
150 %newobject MEDCoupling::DataArrayDouble::selectPartDef;
151 %newobject MEDCoupling::DataArrayDouble::convertToIntArr;
152 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
153 %newobject MEDCoupling::DataArrayDouble::Aggregate;
154 %newobject MEDCoupling::DataArrayDouble::Meld;
155 %newobject MEDCoupling::DataArrayDouble::Dot;
156 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
157 %newobject MEDCoupling::DataArrayDouble::Add;
158 %newobject MEDCoupling::DataArrayDouble::Substract;
159 %newobject MEDCoupling::DataArrayDouble::Multiply;
160 %newobject MEDCoupling::DataArrayDouble::Divide;
161 %newobject MEDCoupling::DataArrayDouble::Pow;
162 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
163 %newobject MEDCoupling::DataArrayDouble::subArray;
164 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
165 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
166 %newobject MEDCoupling::DataArrayDouble::cumSum;
167 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
168 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
169 %newobject MEDCoupling::DataArrayDouble::negate;
170 %newobject MEDCoupling::DataArrayDouble::computeAbs;
171 %newobject MEDCoupling::DataArrayDouble::applyFunc;
172 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
173 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
174 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
175 %newobject MEDCoupling::DataArrayDouble::determinant;
176 %newobject MEDCoupling::DataArrayDouble::eigenValues;
177 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
178 %newobject MEDCoupling::DataArrayDouble::inverse;
179 %newobject MEDCoupling::DataArrayDouble::trace;
180 %newobject MEDCoupling::DataArrayDouble::deviator;
181 %newobject MEDCoupling::DataArrayDouble::magnitude;
182 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
183 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
184 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
185 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
186 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
187 %newobject MEDCoupling::DataArrayDouble::renumber;
188 %newobject MEDCoupling::DataArrayDouble::renumberR;
189 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
190 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
191 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
192 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
193 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
194 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
195 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
196 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
197 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
198 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
199 %newobject MEDCoupling::DataArrayDouble::cartesianize;
200 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
201 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
202 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
203 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
204 %newobject MEDCoupling::DataArrayDouble::__neg__;
205 %newobject MEDCoupling::DataArrayDouble::__radd__;
206 %newobject MEDCoupling::DataArrayDouble::__rsub__;
207 %newobject MEDCoupling::DataArrayDouble::__rmul__;
208 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
209 %newobject MEDCoupling::DataArrayDouble::__pow__;
210 %newobject MEDCoupling::DataArrayDouble::__rpow__;
211 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
213 %newobject MEDCoupling::PartDefinition::New;
214 %newobject MEDCoupling::PartDefinition::toDAI;
215 %newobject MEDCoupling::PartDefinition::__add__;
216 %newobject MEDCoupling::PartDefinition::composeWith;
217 %newobject MEDCoupling::PartDefinition::tryToSimplify;
218 %newobject MEDCoupling::DataArrayPartDefinition::New;
219 %newobject MEDCoupling::SlicePartDefinition::New;
222 %feature("unref") DataArray "$this->decrRef();"
223 %feature("unref") DataArrayDouble "$this->decrRef();"
224 %feature("unref") DataArrayInt "$this->decrRef();"
225 %feature("unref") DataArrayChar "$this->decrRef();"
226 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
227 %feature("unref") DataArrayByte "$this->decrRef();"
229 %feature("unref") PartDefinition "$this->decrRef();"
230 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
231 %feature("unref") SlicePartDefinition "$this->decrRef();"
233 namespace MEDCoupling
240 } MEDCouplingAxisType;
244 class PartDefinition : public RefCountObject, public TimeLabel
247 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
248 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
249 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
250 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
251 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
252 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
253 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
254 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
257 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
259 return (*self)+other;
262 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
265 bool ret0(self->isEqual(other,ret1));
266 PyObject *ret=PyTuple_New(2);
267 PyObject *ret0Py=ret0?Py_True:Py_False;
269 PyTuple_SetItem(ret,0,ret0Py);
270 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
274 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
276 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
280 virtual ~PartDefinition();
283 class DataArrayPartDefinition : public PartDefinition
286 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
289 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
291 return DataArrayPartDefinition::New(listOfIds);
294 std::string __str__() const throw(INTERP_KERNEL::Exception)
296 return self->getRepr();
299 std::string __repr__() const throw(INTERP_KERNEL::Exception)
301 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
302 oss << self->getRepr();
307 virtual ~DataArrayPartDefinition();
310 class SlicePartDefinition : public PartDefinition
313 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
314 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
317 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
319 return SlicePartDefinition::New(start,stop,step);
322 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
325 self->getSlice(a,b,c);
326 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
329 std::string __str__() const throw(INTERP_KERNEL::Exception)
331 return self->getRepr();
334 std::string __repr__() const throw(INTERP_KERNEL::Exception)
336 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
337 oss << self->getRepr();
342 virtual ~SlicePartDefinition();
345 class DataArray : public RefCountObject, public TimeLabel
348 void setName(const std::string& name);
349 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
350 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
351 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
352 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
353 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
354 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
355 std::string getName() const;
356 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
357 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
358 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
359 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
360 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
361 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
362 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
363 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
364 int getNumberOfComponents() const;
365 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
366 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
367 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
368 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
369 virtual void desallocate() throw(INTERP_KERNEL::Exception);
370 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
371 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
372 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
373 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
374 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
375 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
376 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
377 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
378 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
379 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
380 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
381 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
382 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
383 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
384 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
385 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
386 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
387 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
388 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
389 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
390 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
391 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
392 void updateTime() const;
395 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
397 const std::vector<std::string>& comps=self->getInfoOnComponents();
398 PyObject *ret=PyList_New((int)comps.size());
399 for(int i=0;i<(int)comps.size();i++)
400 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
404 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
406 std::vector<int> tmp;
407 convertPyToNewIntArr3(li,tmp);
408 self->copyPartOfStringInfoFrom(other,tmp);
411 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
413 std::vector<int> tmp;
414 convertPyToNewIntArr3(li,tmp);
415 self->copyPartOfStringInfoFrom2(tmp,other);
418 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
421 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
422 if (!SWIG_IsOK(res1))
425 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
426 if(size!=self->getNumberOfTuples())
428 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
430 self->renumberInPlace(tmp);
434 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
436 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
437 da2->checkAllocated();
438 int size=self->getNumberOfTuples();
439 if(size!=self->getNumberOfTuples())
441 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
443 self->renumberInPlace(da2->getConstPointer());
447 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
450 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
451 if (!SWIG_IsOK(res1))
454 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
455 if(size!=self->getNumberOfTuples())
457 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
459 self->renumberInPlaceR(tmp);
463 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
465 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
466 da2->checkAllocated();
467 int size=self->getNumberOfTuples();
468 if(size!=self->getNumberOfTuples())
470 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
472 self->renumberInPlaceR(da2->getConstPointer());
476 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
477 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
479 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
480 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
481 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
482 DataArrayInt *tuplesSelecPtr2=0;
485 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
487 throw INTERP_KERNEL::Exception(msg);
489 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
492 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
494 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
495 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
498 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
500 std::vector<std::pair<int,int> > ranges;
501 convertPyToVectorPairInt(li,ranges);
502 return self->selectByTupleRanges(ranges);
505 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
508 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
509 if (!SWIG_IsOK(res1))
512 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
513 return self->selectByTupleId(tmp,tmp+size);
517 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
519 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
520 da2->checkAllocated();
521 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
525 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
528 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
529 if (!SWIG_IsOK(res1))
532 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
533 return self->selectByTupleIdSafe(tmp,tmp+size);
537 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
539 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
540 da2->checkAllocated();
541 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
545 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
547 std::vector<int> tmp;
548 convertPyToNewIntArr3(li,tmp);
549 DataArray *ret=self->keepSelectedComponents(tmp);
550 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
553 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
555 if(!PySlice_Check(slic))
556 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
557 Py_ssize_t strt=2,stp=2,step=2;
558 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
559 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
561 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
562 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
565 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
567 if(!PySlice_Check(slic))
568 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
569 Py_ssize_t strt=2,stp=2,step=2;
570 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
571 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
573 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
574 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
577 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
579 if(!PySlice_Check(slic))
580 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
581 Py_ssize_t strt=2,stp=2,step=2;
582 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
583 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
584 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
587 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
589 if(!PySlice_Check(slic))
590 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
591 Py_ssize_t strt=2,stp=2,step=2;
592 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
593 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
594 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
597 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
599 std::vector<const DataArray *> tmp;
600 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
601 return DataArray::Aggregate(tmp);
604 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
606 if(!PySlice_Check(slic))
607 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
608 Py_ssize_t strt=2,stp=2,step=2;
609 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
610 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
611 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
614 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
616 if(!PySlice_Check(slic))
617 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
618 Py_ssize_t strt=2,stp=2,step=2;
619 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
620 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
621 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
624 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
626 PyObject *ret(PyTuple_New(2));
627 std::string a0(self->getName());
628 const std::vector<std::string> &a1(self->getInfoOnComponents());
629 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
632 PyObject *ret1(PyList_New(sz));
633 for(int i=0;i<sz;i++)
634 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
635 PyTuple_SetItem(ret,1,ret1);
640 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
642 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 !";
643 if(!PyTuple_Check(inp))
644 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
645 int sz(PyTuple_Size(inp));
647 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
648 PyObject *a0(PyTuple_GetItem(inp,0));
649 if(!PyString_Check(a0))
650 throw INTERP_KERNEL::Exception(MSG);
651 PyObject *a1(PyTuple_GetItem(inp,1));
652 std::vector<std::string> a1cpp;
653 if(!fillStringVector(a1,a1cpp))
654 throw INTERP_KERNEL::Exception(MSG);
655 self->setName(PyString_AsString(a0));
656 self->setInfoOnComponents(a1cpp);
662 class DataArrayDoubleIterator;
664 class DataArrayDouble : public DataArray
667 static DataArrayDouble *New();
668 double doubleValue() const throw(INTERP_KERNEL::Exception);
669 bool empty() const throw(INTERP_KERNEL::Exception);
670 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
671 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
672 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
673 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
674 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
675 double popBackSilent() throw(INTERP_KERNEL::Exception);
676 void pack() const throw(INTERP_KERNEL::Exception);
677 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
678 void fillWithZero() throw(INTERP_KERNEL::Exception);
679 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
680 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
681 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
682 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
683 void reverse() throw(INTERP_KERNEL::Exception);
684 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
685 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
686 std::string repr() const throw(INTERP_KERNEL::Exception);
687 std::string reprZip() const throw(INTERP_KERNEL::Exception);
688 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
689 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
690 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
691 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
692 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
693 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
694 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
695 void transpose() throw(INTERP_KERNEL::Exception);
696 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
697 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
698 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
699 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
700 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
701 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
702 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
703 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
704 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
705 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
706 double front() const throw(INTERP_KERNEL::Exception);
707 double back() const throw(INTERP_KERNEL::Exception);
708 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
709 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
710 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
711 double *getPointer() throw(INTERP_KERNEL::Exception);
712 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
713 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
714 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
715 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
716 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
717 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
718 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
719 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
720 double getAverageValue() const throw(INTERP_KERNEL::Exception);
721 double norm2() const throw(INTERP_KERNEL::Exception);
722 double normMax() const throw(INTERP_KERNEL::Exception);
723 double normMin() const throw(INTERP_KERNEL::Exception);
724 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
725 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
726 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
727 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
728 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
729 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
730 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
731 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
732 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
733 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
734 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
735 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
736 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
737 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
738 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
739 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
740 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
741 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
742 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
743 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
744 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
745 void abs() throw(INTERP_KERNEL::Exception);
746 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
747 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
748 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
749 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
750 void applyPow(double val) throw(INTERP_KERNEL::Exception);
751 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
752 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
753 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
754 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
755 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
756 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
757 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
758 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
759 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
760 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
761 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
762 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
763 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
764 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
765 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
766 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
767 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
768 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
769 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
770 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
771 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
772 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
773 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
774 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
775 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
776 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
777 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
778 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
781 DataArrayDouble() throw(INTERP_KERNEL::Exception)
783 return DataArrayDouble::New();
786 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
788 const char *msgBase="MEDCoupling::DataArrayDouble::New : Available API are : \n-DataArrayDouble.New()\n-DataArrayDouble.New([1.,3.,4.])\n-DataArrayDouble.New([1.,3.,4.],3)\n-DataArrayDouble.New([1.,3.,4.,5.],2,2)\n-DataArrayDouble.New([1.,3.,4.,5.,7,8.],3,2)\n-DataArrayDouble.New([(1.,3.),(4.,5.),(7,8.)])\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2)";
789 std::string msg(msgBase);
791 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
794 if(PyList_Check(elt0) || PyTuple_Check(elt0))
798 if(PyInt_Check(nbOfTuples))
800 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
802 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
805 if(PyInt_Check(elt2))
806 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
807 int nbOfCompo=PyInt_AS_LONG(elt2);
809 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
810 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
811 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
812 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
816 throw INTERP_KERNEL::Exception(msg.c_str());
819 {//DataArrayDouble.New([1.,3.,4.],3)
820 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
822 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
823 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
828 throw INTERP_KERNEL::Exception(msg.c_str());
831 {// DataArrayDouble.New([1.,3.,4.])
832 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
833 int tmpp1=-1,tmpp2=-1;
834 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
835 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
839 else if(PyInt_Check(elt0))
841 int nbOfTuples1=PyInt_AS_LONG(elt0);
843 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
848 if(PyInt_Check(nbOfTuples))
849 {//DataArrayDouble.New(5,2)
850 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
852 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
853 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
854 ret->alloc(nbOfTuples1,nbOfCompo);
858 throw INTERP_KERNEL::Exception(msg.c_str());
861 throw INTERP_KERNEL::Exception(msg.c_str());
864 {//DataArrayDouble.New(5)
865 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
866 ret->alloc(nbOfTuples1,1);
871 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
872 {//DataArrayDouble.New(numpyArray)
873 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
877 throw INTERP_KERNEL::Exception(msg.c_str());
878 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
881 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
883 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
886 DataArrayDouble *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
888 MCAuto<DataArrayDouble> ret(self->selectPartDef(pd));
892 DataArrayDouble *cumSum() const throw(INTERP_KERNEL::Exception)
894 MCAuto<DataArrayDouble> ret(self->cumSum());
898 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
901 std::vector<double> bb;
903 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
904 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
905 self->pushBackValsSilent(tmp,tmp+nbTuples);
908 std::string __repr__() const throw(INTERP_KERNEL::Exception)
910 std::ostringstream oss;
911 self->reprQuickOverview(oss);
915 std::string __str__() const throw(INTERP_KERNEL::Exception)
917 return self->reprNotTooLong();
920 double __float__() const throw(INTERP_KERNEL::Exception)
922 return self->doubleValue();
925 int __len__() const throw(INTERP_KERNEL::Exception)
927 if(self->isAllocated())
929 return self->getNumberOfTuples();
933 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
937 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
939 return self->iterator();
942 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
944 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 !";
945 if(PyList_Check(li) || PyTuple_Check(li))
949 if(PyInt_Check(nbOfTuples))
951 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
953 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
956 if(PyInt_Check(nbOfComp))
957 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
958 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
960 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
961 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
962 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
965 throw INTERP_KERNEL::Exception(msg);
968 {//DataArrayDouble.setValues([1.,3.,4.],3)
970 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
971 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
975 throw INTERP_KERNEL::Exception(msg);
978 {// DataArrayDouble.setValues([1.,3.,4.])
979 int tmpp1=-1,tmpp2=-1;
980 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
981 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
985 throw INTERP_KERNEL::Exception(msg);
988 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
990 const double *vals=self->getConstPointer();
991 return convertDblArrToPyList(vals,self->getNbOfElems());
995 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
997 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1001 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1004 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1005 PyObject *ret=PyTuple_New(2);
1006 PyObject *ret0Py=ret0?Py_True:Py_False;
1008 PyTuple_SetItem(ret,0,ret0Py);
1009 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1013 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1015 const double *vals=self->getConstPointer();
1016 int nbOfComp=self->getNumberOfComponents();
1017 int nbOfTuples=self->getNumberOfTuples();
1018 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
1021 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1023 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1025 DataArrayDouble *a,*a2;
1026 DataArrayDoubleTuple *aa,*aa2;
1027 std::vector<double> bb,bb2;
1029 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1030 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1031 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1035 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1037 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1039 DataArrayDouble *a,*a2;
1040 DataArrayDoubleTuple *aa,*aa2;
1041 std::vector<double> bb,bb2;
1043 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1045 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1046 return convertDblArrToPyListOfTuple(res,3,3);
1049 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1051 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1053 DataArrayDouble *a,*a2;
1054 DataArrayDoubleTuple *aa,*aa2;
1055 std::vector<double> bb,bb2;
1057 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1058 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1059 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1062 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1065 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1066 if (!SWIG_IsOK(res1))
1069 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1070 if(size!=self->getNumberOfTuples())
1072 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1074 return self->renumber(tmp);
1078 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1080 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1081 da2->checkAllocated();
1082 int size=self->getNumberOfTuples();
1083 if(size!=self->getNumberOfTuples())
1085 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1087 return self->renumber(da2->getConstPointer());
1091 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1094 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1095 if (!SWIG_IsOK(res1))
1098 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1099 if(size!=self->getNumberOfTuples())
1101 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1103 return self->renumberR(tmp);
1107 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1109 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1110 da2->checkAllocated();
1111 int size=self->getNumberOfTuples();
1112 if(size!=self->getNumberOfTuples())
1114 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1116 return self->renumberR(da2->getConstPointer());
1120 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1123 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1124 if (!SWIG_IsOK(res1))
1127 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1128 if(size!=self->getNumberOfTuples())
1130 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1132 return self->renumberAndReduce(tmp,newNbOfTuple);
1136 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1138 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1139 da2->checkAllocated();
1140 int size=self->getNumberOfTuples();
1141 if(size!=self->getNumberOfTuples())
1143 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1145 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1149 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1151 int thisTupleId,otherTupleId;
1152 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1153 PyObject *ret=PyTuple_New(3);
1154 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1155 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1156 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1160 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1163 double r1=self->getMaxValue(tmp);
1164 PyObject *ret=PyTuple_New(2);
1165 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1166 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1170 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1173 double r1=self->getMaxValue2(tmp);
1174 PyObject *ret=PyTuple_New(2);
1175 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1176 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1180 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1183 double r1=self->getMinValue(tmp);
1184 PyObject *ret=PyTuple_New(2);
1185 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1186 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1190 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1193 double r1=self->getMinValue2(tmp);
1194 PyObject *ret=PyTuple_New(2);
1195 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1196 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1200 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1202 int nbOfCompo=self->getNumberOfComponents();
1203 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1204 self->getMinMaxPerComponent(tmp);
1205 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1209 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1211 int sz=self->getNumberOfComponents();
1212 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1213 self->accumulate(tmp);
1214 return convertDblArrToPyList(tmp,sz);
1217 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1220 std::vector<int> val2;
1221 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1222 return self->accumulatePerChunck(bg,bg+sz);
1225 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1227 DataArrayInt *comm, *commIndex;
1228 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1229 PyObject *res = PyList_New(2);
1230 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1231 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1235 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1239 DataArrayDoubleTuple *aa;
1240 std::vector<double> bb;
1242 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1243 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1245 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1246 PyObject *ret=PyTuple_New(2);
1247 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1248 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1252 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1254 std::vector<int> tmp;
1255 convertPyToNewIntArr3(li,tmp);
1256 self->setSelectedComponents(a,tmp);
1259 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1261 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1262 std::size_t sz(retCpp.size());
1263 PyObject *res(PyList_New(sz));
1264 for(std::size_t i=0;i<sz;i++)
1265 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1269 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1271 int sz=self->getNumberOfComponents();
1272 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1273 self->getTuple(tupleId,tmp);
1274 return convertDblArrToPyList(tmp,sz);
1277 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1279 std::vector<const DataArrayDouble *> tmp;
1280 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1281 return DataArrayDouble::Aggregate(tmp);
1284 static DataArrayDouble *Meld(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::Meld(tmp);
1291 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1295 DataArrayDoubleTuple *aa;
1296 std::vector<double> bb;
1298 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1299 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1300 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1301 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1302 DataArrayInt *c=0,*cI=0;
1303 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1304 PyObject *ret=PyTuple_New(2);
1305 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1306 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1310 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1312 DataArrayInt *ret1=0;
1313 bool ret0=self->areIncludedInMe(other,prec,ret1);
1314 PyObject *ret=PyTuple_New(2);
1315 PyObject *ret0Py=ret0?Py_True:Py_False;
1317 PyTuple_SetItem(ret,0,ret0Py);
1318 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1322 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1324 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1325 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1326 self->checkAllocated();
1327 int nbOfTuples=self->getNumberOfTuples();
1328 int nbOfComponents=self->getNumberOfComponents();
1330 std::vector<int> vt1,vc1;
1331 std::pair<int, std::pair<int,int> > pt1,pc1;
1332 DataArrayInt *dt1=0,*dc1=0;
1334 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1335 MCAuto<DataArrayDouble> ret;
1339 if(nbOfComponents==1)
1340 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1341 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1343 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1345 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1347 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1349 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1352 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1353 std::vector<int> v2(1,ic1);
1354 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1358 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1359 std::vector<int> v2(1,ic1);
1360 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1364 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1365 std::vector<int> v2(1,ic1);
1366 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1370 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1371 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1375 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1376 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1380 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1381 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1385 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1386 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1390 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1391 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1392 std::vector<int> v2(nbOfComp);
1393 for(int i=0;i<nbOfComp;i++)
1394 v2[i]=pc1.first+i*pc1.second.second;
1395 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1399 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1400 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1401 std::vector<int> v2(nbOfComp);
1402 for(int i=0;i<nbOfComp;i++)
1403 v2[i]=pc1.first+i*pc1.second.second;
1404 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1408 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1409 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1410 std::vector<int> v2(nbOfComp);
1411 for(int i=0;i<nbOfComp;i++)
1412 v2[i]=pc1.first+i*pc1.second.second;
1413 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1417 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1418 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1419 std::vector<int> v2(nbOfComp);
1420 for(int i=0;i<nbOfComp;i++)
1421 v2[i]=pc1.first+i*pc1.second.second;
1422 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1425 throw INTERP_KERNEL::Exception(msg);
1429 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1431 self->checkAllocated();
1432 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1433 int nbOfTuples=self->getNumberOfTuples();
1434 int nbOfComponents=self->getNumberOfComponents();
1437 std::vector<double> v1;
1438 DataArrayDouble *d1=0;
1439 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1441 std::vector<int> vt1,vc1;
1442 std::pair<int, std::pair<int,int> > pt1,pc1;
1443 DataArrayInt *dt1=0,*dc1=0;
1444 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1445 MCAuto<DataArrayDouble> tmp;
1453 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1456 tmp=DataArrayDouble::New();
1457 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1458 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1461 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1464 throw INTERP_KERNEL::Exception(msg);
1473 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1476 tmp=DataArrayDouble::New();
1477 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1478 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1481 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1484 throw INTERP_KERNEL::Exception(msg);
1493 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1496 tmp=DataArrayDouble::New();
1497 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1498 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1501 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1504 throw INTERP_KERNEL::Exception(msg);
1513 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1516 tmp=DataArrayDouble::New();
1517 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1518 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1521 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1524 throw INTERP_KERNEL::Exception(msg);
1533 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1536 tmp=DataArrayDouble::New();
1537 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1538 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1541 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1544 throw INTERP_KERNEL::Exception(msg);
1553 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1556 tmp=DataArrayDouble::New();
1557 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1558 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1561 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1564 throw INTERP_KERNEL::Exception(msg);
1573 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1576 tmp=DataArrayDouble::New();
1577 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1578 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1581 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1584 throw INTERP_KERNEL::Exception(msg);
1593 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1596 tmp=DataArrayDouble::New();
1597 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1598 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1601 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1604 throw INTERP_KERNEL::Exception(msg);
1613 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1616 tmp=DataArrayDouble::New();
1617 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1618 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1621 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1624 throw INTERP_KERNEL::Exception(msg);
1633 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1636 tmp=DataArrayDouble::New();
1637 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1638 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1641 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1644 throw INTERP_KERNEL::Exception(msg);
1653 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1656 tmp=DataArrayDouble::New();
1657 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1658 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1661 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1664 throw INTERP_KERNEL::Exception(msg);
1673 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1676 tmp=DataArrayDouble::New();
1677 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1678 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1681 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1684 throw INTERP_KERNEL::Exception(msg);
1693 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1696 tmp=DataArrayDouble::New();
1697 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1698 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1701 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1704 throw INTERP_KERNEL::Exception(msg);
1713 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1716 tmp=DataArrayDouble::New();
1717 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1718 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1721 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1724 throw INTERP_KERNEL::Exception(msg);
1733 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1736 tmp=DataArrayDouble::New();
1737 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1738 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1741 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1744 throw INTERP_KERNEL::Exception(msg);
1753 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1756 tmp=DataArrayDouble::New();
1757 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1758 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1761 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1764 throw INTERP_KERNEL::Exception(msg);
1769 throw INTERP_KERNEL::Exception(msg);
1774 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1776 return self->negate();
1779 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1781 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1784 DataArrayDoubleTuple *aa;
1785 std::vector<double> bb;
1788 #ifndef WITHOUT_AUTOFIELD
1790 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1792 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1795 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1796 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1798 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1801 throw INTERP_KERNEL::Exception(msg);
1805 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1810 MCAuto<DataArrayDouble> ret=self->deepCopy();
1811 ret->applyLin(1.,val);
1812 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1816 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1820 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1821 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1825 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1826 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1829 throw INTERP_KERNEL::Exception(msg);
1833 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1835 const char msg[]="Unexpected situation in __radd__ !";
1838 DataArrayDoubleTuple *aa;
1839 std::vector<double> bb;
1841 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1846 MCAuto<DataArrayDouble> ret=self->deepCopy();
1847 ret->applyLin(1.,val);
1852 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1853 return DataArrayDouble::Add(self,aaa);
1857 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1858 return DataArrayDouble::Add(self,aaa);
1861 throw INTERP_KERNEL::Exception(msg);
1865 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1867 const char msg[]="Unexpected situation in __iadd__ !";
1870 DataArrayDoubleTuple *aa;
1871 std::vector<double> bb;
1873 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1878 self->applyLin(1.,val);
1879 Py_XINCREF(trueSelf);
1885 Py_XINCREF(trueSelf);
1890 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1891 self->addEqual(aaa);
1892 Py_XINCREF(trueSelf);
1897 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1898 self->addEqual(aaa);
1899 Py_XINCREF(trueSelf);
1903 throw INTERP_KERNEL::Exception(msg);
1907 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1909 const char msg[]="Unexpected situation in __sub__ !";
1912 DataArrayDoubleTuple *aa;
1913 std::vector<double> bb;
1916 #ifndef WITHOUT_AUTOFIELD
1918 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1920 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1923 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1924 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1926 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1929 throw INTERP_KERNEL::Exception(msg);
1933 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1938 MCAuto<DataArrayDouble> ret=self->deepCopy();
1939 ret->applyLin(1.,-val);
1940 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1944 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1948 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1949 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1953 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1954 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1957 throw INTERP_KERNEL::Exception(msg);
1961 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1963 const char msg[]="Unexpected situation in __rsub__ !";
1966 DataArrayDoubleTuple *aa;
1967 std::vector<double> bb;
1969 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1974 MCAuto<DataArrayDouble> ret=self->deepCopy();
1975 ret->applyLin(-1.,val);
1980 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1981 return DataArrayDouble::Substract(aaa,self);
1985 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1986 return DataArrayDouble::Substract(aaa,self);
1989 throw INTERP_KERNEL::Exception(msg);
1993 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1995 const char msg[]="Unexpected situation in __isub__ !";
1998 DataArrayDoubleTuple *aa;
1999 std::vector<double> bb;
2001 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2006 self->applyLin(1,-val);
2007 Py_XINCREF(trueSelf);
2012 self->substractEqual(a);
2013 Py_XINCREF(trueSelf);
2018 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2019 self->substractEqual(aaa);
2020 Py_XINCREF(trueSelf);
2025 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2026 self->substractEqual(aaa);
2027 Py_XINCREF(trueSelf);
2031 throw INTERP_KERNEL::Exception(msg);
2035 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2037 const char msg[]="Unexpected situation in __mul__ !";
2040 DataArrayDoubleTuple *aa;
2041 std::vector<double> bb;
2044 #ifndef WITHOUT_AUTOFIELD
2046 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
2048 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
2051 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
2052 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
2054 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
2057 throw INTERP_KERNEL::Exception(msg);
2061 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2066 MCAuto<DataArrayDouble> ret=self->deepCopy();
2067 ret->applyLin(val,0.);
2068 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2072 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2076 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2077 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2081 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2082 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2085 throw INTERP_KERNEL::Exception(msg);
2089 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2091 const char msg[]="Unexpected situation in __rmul__ !";
2094 DataArrayDoubleTuple *aa;
2095 std::vector<double> bb;
2097 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2102 MCAuto<DataArrayDouble> ret=self->deepCopy();
2103 ret->applyLin(val,0.);
2108 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2109 return DataArrayDouble::Multiply(self,aaa);
2113 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2114 return DataArrayDouble::Multiply(self,aaa);
2117 throw INTERP_KERNEL::Exception(msg);
2121 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2123 const char msg[]="Unexpected situation in __imul__ !";
2126 DataArrayDoubleTuple *aa;
2127 std::vector<double> bb;
2129 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2134 self->applyLin(val,0.);
2135 Py_XINCREF(trueSelf);
2140 self->multiplyEqual(a);
2141 Py_XINCREF(trueSelf);
2146 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2147 self->multiplyEqual(aaa);
2148 Py_XINCREF(trueSelf);
2153 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2154 self->multiplyEqual(aaa);
2155 Py_XINCREF(trueSelf);
2159 throw INTERP_KERNEL::Exception(msg);
2163 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2165 const char msg[]="Unexpected situation in __div__ !";
2168 DataArrayDoubleTuple *aa;
2169 std::vector<double> bb;
2172 #ifndef WITHOUT_AUTOFIELD
2174 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
2176 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
2179 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
2180 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
2182 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
2185 throw INTERP_KERNEL::Exception(msg);
2189 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2195 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2196 MCAuto<DataArrayDouble> ret=self->deepCopy();
2197 ret->applyLin(1/val,0.);
2198 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2202 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2206 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2207 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2211 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2212 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2215 throw INTERP_KERNEL::Exception(msg);
2219 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2221 const char msg[]="Unexpected situation in __rdiv__ !";
2224 DataArrayDoubleTuple *aa;
2225 std::vector<double> bb;
2227 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2232 MCAuto<DataArrayDouble> ret=self->deepCopy();
2238 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2239 return DataArrayDouble::Divide(aaa,self);
2243 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2244 return DataArrayDouble::Divide(aaa,self);
2247 throw INTERP_KERNEL::Exception(msg);
2251 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2253 const char msg[]="Unexpected situation in __idiv__ !";
2256 DataArrayDoubleTuple *aa;
2257 std::vector<double> bb;
2259 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2265 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2266 self->applyLin(1./val,0.);
2267 Py_XINCREF(trueSelf);
2272 self->divideEqual(a);
2273 Py_XINCREF(trueSelf);
2278 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2279 self->divideEqual(aaa);
2280 Py_XINCREF(trueSelf);
2285 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2286 self->divideEqual(aaa);
2287 Py_XINCREF(trueSelf);
2291 throw INTERP_KERNEL::Exception(msg);
2295 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2297 const char msg[]="Unexpected situation in __pow__ !";
2300 DataArrayDoubleTuple *aa;
2301 std::vector<double> bb;
2303 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2308 MCAuto<DataArrayDouble> ret=self->deepCopy();
2314 return DataArrayDouble::Pow(self,a);
2318 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2319 return DataArrayDouble::Pow(self,aaa);
2323 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2324 return DataArrayDouble::Pow(self,aaa);
2327 throw INTERP_KERNEL::Exception(msg);
2331 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2333 const char msg[]="Unexpected situation in __rpow__ !";
2336 DataArrayDoubleTuple *aa;
2337 std::vector<double> bb;
2339 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2344 MCAuto<DataArrayDouble> ret=self->deepCopy();
2345 ret->applyRPow(val);
2350 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2351 return DataArrayDouble::Pow(aaa,self);
2355 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2356 return DataArrayDouble::Pow(aaa,self);
2359 throw INTERP_KERNEL::Exception(msg);
2363 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2365 const char msg[]="Unexpected situation in __ipow__ !";
2368 DataArrayDoubleTuple *aa;
2369 std::vector<double> bb;
2371 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2376 self->applyPow(val);
2377 Py_XINCREF(trueSelf);
2383 Py_XINCREF(trueSelf);
2388 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2389 self->powEqual(aaa);
2390 Py_XINCREF(trueSelf);
2395 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2396 self->powEqual(aaa);
2397 Py_XINCREF(trueSelf);
2401 throw INTERP_KERNEL::Exception(msg);
2405 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2407 DataArrayInt *c=0,*cI=0;
2409 self->computeTupleIdsNearTuples(other,eps,c,cI);
2410 PyObject *ret=PyTuple_New(2);
2411 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2412 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2416 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2418 DataArrayInt *ret1=0;
2419 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2420 PyObject *ret=PyTuple_New(2);
2421 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2422 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2427 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2429 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
2432 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2435 if(!self->isAllocated())
2436 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2437 PyObject *ret(PyTuple_New(1));
2438 PyObject *ret0(PyDict_New());
2439 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2440 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2441 PyObject *tmp1(PyInt_FromLong(0));
2442 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2443 PyTuple_SetItem(ret,0,ret0);
2447 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2453 class DataArrayDoubleTuple;
2455 class DataArrayDoubleIterator
2458 DataArrayDoubleIterator(DataArrayDouble *da);
2459 ~DataArrayDoubleIterator();
2464 DataArrayDoubleTuple *ret=self->nextt();
2466 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2469 PyErr_SetString(PyExc_StopIteration,"No more data.");
2476 class DataArrayDoubleTuple
2479 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2480 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2483 std::string __str__() const throw(INTERP_KERNEL::Exception)
2485 return self->repr();
2488 double __float__() const throw(INTERP_KERNEL::Exception)
2490 return self->doubleValue();
2493 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2495 return self->buildDADouble(1,self->getNumberOfCompo());
2498 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2500 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2501 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2502 Py_XINCREF(trueSelf);
2506 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2508 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2509 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2510 Py_XINCREF(trueSelf);
2514 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2516 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2517 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2518 Py_XINCREF(trueSelf);
2522 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2524 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2525 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2526 Py_XINCREF(trueSelf);
2530 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2532 return PyInt_FromLong(self->getNumberOfCompo());
2535 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2537 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2540 std::vector<int> multiVal;
2541 std::pair<int, std::pair<int,int> > slic;
2542 MEDCoupling::DataArrayInt *daIntTyypp=0;
2543 const double *pt=self->getConstPointer();
2544 int nbc=self->getNumberOfCompo();
2545 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2552 std::ostringstream oss;
2553 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2554 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2558 return PyFloat_FromDouble(pt[singleVal]);
2562 return PyFloat_FromDouble(pt[nbc+singleVal]);
2565 std::ostringstream oss;
2566 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2567 throw INTERP_KERNEL::Exception(oss.str().c_str());
2573 PyObject *t=PyTuple_New(multiVal.size());
2574 for(int j=0;j<(int)multiVal.size();j++)
2576 int cid=multiVal[j];
2579 std::ostringstream oss;
2580 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2581 throw INTERP_KERNEL::Exception(oss.str().c_str());
2583 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2589 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2590 PyObject *t=PyTuple_New(sz);
2591 for(int j=0;j<sz;j++)
2592 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2596 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2600 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2602 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2603 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2606 std::vector<double> multiValV;
2607 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2608 int nbc=self->getNumberOfCompo();
2609 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2611 std::vector<int> multiVal;
2612 std::pair<int, std::pair<int,int> > slic;
2613 MEDCoupling::DataArrayInt *daIntTyypp=0;
2614 double *pt=self->getPointer();
2615 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2622 std::ostringstream oss;
2623 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2624 throw INTERP_KERNEL::Exception(oss.str().c_str());
2630 pt[singleVal]=singleValV;
2635 if(multiValV.size()!=1)
2637 std::ostringstream oss;
2638 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2639 throw INTERP_KERNEL::Exception(oss.str().c_str());
2641 pt[singleVal]=multiValV[0];
2646 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2650 throw INTERP_KERNEL::Exception(msg);
2659 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2663 std::ostringstream oss;
2664 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2665 throw INTERP_KERNEL::Exception(oss.str().c_str());
2673 if(multiVal.size()!=multiValV.size())
2675 std::ostringstream oss;
2676 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2677 throw INTERP_KERNEL::Exception(oss.str().c_str());
2679 for(int i=0;i<(int)multiVal.size();i++)
2681 int pos=multiVal[i];
2684 std::ostringstream oss;
2685 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2686 throw INTERP_KERNEL::Exception(oss.str().c_str());
2688 pt[multiVal[i]]=multiValV[i];
2694 const double *ptV=daIntTyyppV->getConstPointer();
2695 if(nbc>daIntTyyppV->getNumberOfCompo())
2697 std::ostringstream oss;
2698 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2699 throw INTERP_KERNEL::Exception(oss.str().c_str());
2701 std::copy(ptV,ptV+nbc,pt);
2705 throw INTERP_KERNEL::Exception(msg);
2710 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2715 for(int j=0;j<sz;j++)
2716 pt[slic.first+j*slic.second.second]=singleValV;
2721 if(sz!=(int)multiValV.size())
2723 std::ostringstream oss;
2724 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2725 throw INTERP_KERNEL::Exception(oss.str().c_str());
2727 for(int j=0;j<sz;j++)
2728 pt[slic.first+j*slic.second.second]=multiValV[j];
2733 const double *ptV=daIntTyyppV->getConstPointer();
2734 if(sz>daIntTyyppV->getNumberOfCompo())
2736 std::ostringstream oss;
2737 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2738 throw INTERP_KERNEL::Exception(oss.str().c_str());
2740 for(int j=0;j<sz;j++)
2741 pt[slic.first+j*slic.second.second]=ptV[j];
2745 throw INTERP_KERNEL::Exception(msg);
2749 throw INTERP_KERNEL::Exception(msg);
2755 class DataArrayIntIterator;
2757 class DataArrayInt : public DataArray
2760 static DataArrayInt *New();
2761 int intValue() const throw(INTERP_KERNEL::Exception);
2762 int getHashCode() const throw(INTERP_KERNEL::Exception);
2763 bool empty() const throw(INTERP_KERNEL::Exception);
2764 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2765 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2766 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2767 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2768 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2769 int popBackSilent() throw(INTERP_KERNEL::Exception);
2770 void pack() const throw(INTERP_KERNEL::Exception);
2771 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2772 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2773 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2774 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2775 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2776 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2777 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2778 void reverse() throw(INTERP_KERNEL::Exception);
2779 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2780 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2781 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2782 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2783 void fillWithZero() throw(INTERP_KERNEL::Exception);
2784 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2785 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2786 std::string repr() const throw(INTERP_KERNEL::Exception);
2787 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2788 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2789 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2790 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2791 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2792 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2793 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2794 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2795 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2796 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2797 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2798 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2799 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2800 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2801 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2802 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2803 void transpose() throw(INTERP_KERNEL::Exception);
2804 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2805 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2806 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2807 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2808 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2809 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2810 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2811 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2812 int front() const throw(INTERP_KERNEL::Exception);
2813 int back() const throw(INTERP_KERNEL::Exception);
2814 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2815 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2816 int *getPointer() throw(INTERP_KERNEL::Exception);
2817 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2818 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2819 const int *begin() const throw(INTERP_KERNEL::Exception);
2820 const int *end() const throw(INTERP_KERNEL::Exception);
2821 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2822 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2823 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2824 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2825 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2826 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2827 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2828 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2829 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2830 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2831 int count(int value) const throw(INTERP_KERNEL::Exception);
2832 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2833 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2834 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2835 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2836 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2837 void abs() throw(INTERP_KERNEL::Exception);
2838 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2839 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2840 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2841 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2842 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2843 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2844 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2845 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2846 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2847 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2848 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2849 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2850 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2851 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2852 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2853 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2854 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2855 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2856 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2857 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2858 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2859 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2860 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2861 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2862 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2863 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2864 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2865 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2866 void computeOffsets() throw(INTERP_KERNEL::Exception);
2867 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2868 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2869 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2870 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2871 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2872 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2873 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2874 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2875 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2876 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2877 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2878 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2879 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2880 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2881 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2882 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2883 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2884 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2885 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2887 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2890 DataArrayInt() throw(INTERP_KERNEL::Exception)
2892 return DataArrayInt::New();
2895 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2897 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)";
2898 std::string msg(msgBase);
2900 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2903 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2907 if(PyInt_Check(nbOfTuples))
2909 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2911 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2914 if(PyInt_Check(nbOfComp))
2915 {//DataArrayInt.New([1,3,4,5],2,2)
2916 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2918 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2919 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2920 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2921 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2925 throw INTERP_KERNEL::Exception(msg.c_str());
2928 {//DataArrayInt.New([1,3,4],3)
2929 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2931 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2932 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2937 throw INTERP_KERNEL::Exception(msg.c_str());
2940 {// DataArrayInt.New([1,3,4])
2941 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2942 int tmpp1=-1,tmpp2=-1;
2943 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2944 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2948 else if(PyInt_Check(elt0))
2950 int nbOfTuples1=PyInt_AS_LONG(elt0);
2952 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2957 if(PyInt_Check(nbOfTuples))
2958 {//DataArrayInt.New(5,2)
2959 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2961 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2962 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2963 ret->alloc(nbOfTuples1,nbOfCompo);
2967 throw INTERP_KERNEL::Exception(msg.c_str());
2970 throw INTERP_KERNEL::Exception(msg.c_str());
2973 {//DataArrayInt.New(5)
2974 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2975 ret->alloc(nbOfTuples1,1);
2980 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2981 {//DataArrayInt.New(numpyArray)
2982 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2986 throw INTERP_KERNEL::Exception(msg.c_str());
2987 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2990 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2992 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2995 std::string __str__() const throw(INTERP_KERNEL::Exception)
2997 return self->reprNotTooLong();
3000 int __len__() const throw(INTERP_KERNEL::Exception)
3002 if(self->isAllocated())
3004 return self->getNumberOfTuples();
3008 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
3012 int __int__() const throw(INTERP_KERNEL::Exception)
3014 return self->intValue();
3017 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
3019 return self->iterator();
3022 DataArrayInt *fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception)
3024 MCAuto<DataArrayInt> ret(self->fromLinkedListOfPairToList());
3028 DataArrayInt *findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
3030 MCAuto<DataArrayInt> ret(self->findIdsGreaterOrEqualTo(val));
3034 DataArrayInt *findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception)
3036 MCAuto<DataArrayInt> ret(self->findIdsGreaterThan(val));
3040 DataArrayInt *findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
3042 MCAuto<DataArrayInt> ret(self->findIdsLowerOrEqualTo(val));
3046 DataArrayInt *findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception)
3048 MCAuto<DataArrayInt> ret(self->findIdsLowerThan(val));
3052 DataArrayInt *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
3054 MCAuto<DataArrayInt> ret(self->selectPartDef(pd));
3058 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3060 int sz=self->getNumberOfComponents();
3061 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3062 self->accumulate(tmp);
3063 return convertIntArrToPyList(tmp,sz);
3066 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
3069 std::vector<int> val2;
3070 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
3071 return self->accumulatePerChunck(bg,bg+sz);
3074 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
3077 std::vector<int> val2;
3078 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
3079 return self->findIdsEqualTuple(bg,bg+sz);
3082 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
3084 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
3085 PyObject *ret=PyList_New(slcs.size());
3086 for(std::size_t i=0;i<slcs.size();i++)
3087 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
3091 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
3093 if(!PySlice_Check(slic))
3094 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
3095 Py_ssize_t strt=2,stp=2,step=2;
3096 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
3097 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
3098 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
3099 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 !");
3100 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
3103 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
3106 self->getMinMaxValues(a,b);
3107 PyObject *ret=PyTuple_New(2);
3108 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
3109 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
3113 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
3115 int newNbOfTuples=-1;
3116 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
3117 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
3118 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
3119 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
3120 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
3121 PyObject *ret=PyTuple_New(2);
3122 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3123 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
3127 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
3129 MCAuto<DataArrayInt> ret(DataArrayInt::New());
3130 int szArr,sw,iTypppArr;
3131 std::vector<int> stdvecTyyppArr;
3132 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
3133 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
3134 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
3138 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3140 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 !";
3141 if(PyList_Check(li) || PyTuple_Check(li))
3143 if(nbOfTuples && nbOfTuples != Py_None)
3145 if(PyInt_Check(nbOfTuples))
3147 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
3149 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
3150 if(nbOfComp && nbOfComp != Py_None)
3152 if(PyInt_Check(nbOfComp))
3153 {//DataArrayInt.setValues([1,3,4,5],2,2)
3154 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
3156 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
3157 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
3158 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
3161 throw INTERP_KERNEL::Exception(msg);
3164 {//DataArrayInt.setValues([1,3,4],3)
3166 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
3167 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
3171 throw INTERP_KERNEL::Exception(msg);
3174 {// DataArrayInt.setValues([1,3,4])
3175 int tmpp1=-1,tmpp2=-1;
3176 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
3177 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
3181 throw INTERP_KERNEL::Exception(msg);
3184 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
3186 const int *vals=self->getConstPointer();
3187 return convertIntArrToPyList(vals,self->getNbOfElems());
3191 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
3193 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
3197 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
3200 bool ret0=self->isEqualIfNotWhy(other,ret1);
3201 PyObject *ret=PyTuple_New(2);
3202 PyObject *ret0Py=ret0?Py_True:Py_False;
3204 PyTuple_SetItem(ret,0,ret0Py);
3205 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3209 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
3211 const int *vals=self->getConstPointer();
3212 int nbOfComp=self->getNumberOfComponents();
3213 int nbOfTuples=self->getNumberOfTuples();
3214 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
3217 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
3219 std::vector<const DataArrayInt *> groups;
3220 std::vector< std::vector<int> > fidsOfGroups;
3221 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
3222 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3223 PyObject *ret = PyList_New(2);
3224 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3225 int sz=fidsOfGroups.size();
3226 PyObject *ret1 = PyList_New(sz);
3227 for(int i=0;i<sz;i++)
3228 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3229 PyList_SetItem(ret,1,ret1);
3233 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3236 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3237 if (!SWIG_IsOK(res1))
3240 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3241 self->transformWithIndArr(tmp,tmp+size);
3245 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3246 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3250 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3254 std::vector<int> multiVal;
3255 std::pair<int, std::pair<int,int> > slic;
3256 MEDCoupling::DataArrayInt *daIntTyypp=0;
3257 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3261 return self->findIdsEqualList(&singleVal,&singleVal+1);
3263 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3265 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3267 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3271 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3275 std::vector<int> multiVal;
3276 std::pair<int, std::pair<int,int> > slic;
3277 MEDCoupling::DataArrayInt *daIntTyypp=0;
3278 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3282 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
3284 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3286 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3288 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3292 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3294 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3296 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3297 if (!SWIG_IsOK(res1))
3300 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3301 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3305 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3307 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3308 da2->checkAllocated();
3309 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
3311 PyObject *ret = PyList_New(3);
3312 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3313 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3314 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3318 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3321 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3322 if (!SWIG_IsOK(res1))
3325 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3326 return self->transformWithIndArrR(tmp,tmp+size);
3330 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3331 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3335 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3338 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3339 if (!SWIG_IsOK(res1))
3342 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3343 if(size!=self->getNumberOfTuples())
3345 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3347 return self->renumberAndReduce(tmp,newNbOfTuple);
3351 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3353 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3354 da2->checkAllocated();
3355 int size=self->getNumberOfTuples();
3356 if(size!=self->getNumberOfTuples())
3358 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3360 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3364 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3367 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3368 if (!SWIG_IsOK(res1))
3371 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3372 if(size!=self->getNumberOfTuples())
3374 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3376 return self->renumber(tmp);
3380 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3382 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3383 da2->checkAllocated();
3384 int size=self->getNumberOfTuples();
3385 if(size!=self->getNumberOfTuples())
3387 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3389 return self->renumber(da2->getConstPointer());
3393 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3396 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3397 if (!SWIG_IsOK(res1))
3400 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3401 if(size!=self->getNumberOfTuples())
3403 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3405 return self->renumberR(tmp);
3409 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3411 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3412 da2->checkAllocated();
3413 int size=self->getNumberOfTuples();
3414 if(size!=self->getNumberOfTuples())
3416 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3418 return self->renumberR(da2->getConstPointer());
3422 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3424 std::vector<int> tmp;
3425 convertPyToNewIntArr3(li,tmp);
3426 self->setSelectedComponents(a,tmp);
3429 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
3431 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
3432 std::size_t sz(retCpp.size());
3433 PyObject *res(PyList_New(sz));
3434 for(std::size_t i=0;i<sz;i++)
3435 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3439 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3441 int sz=self->getNumberOfComponents();
3442 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3443 self->getTuple(tupleId,tmp);
3444 return convertIntArrToPyList(tmp,sz);
3447 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3449 DataArrayInt *arr=0;
3450 DataArrayInt *arrI=0;
3451 self->changeSurjectiveFormat(targetNb,arr,arrI);
3452 PyObject *res = PyList_New(2);
3453 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3454 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3458 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3460 std::vector<const DataArrayInt *> tmp;
3461 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3462 return DataArrayInt::Meld(tmp);
3465 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3467 std::vector<const DataArrayInt *> tmp;
3468 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3469 return DataArrayInt::Aggregate(tmp);
3472 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3474 std::vector<const DataArrayInt *> tmp;
3475 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3476 return DataArrayInt::AggregateIndexes(tmp);
3479 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3481 std::vector<const DataArrayInt *> tmp;
3482 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3483 return DataArrayInt::BuildUnion(tmp);
3486 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3488 std::vector<const DataArrayInt *> tmp;
3489 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3490 return DataArrayInt::BuildIntersection(tmp);
3493 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3496 int r1=self->getMaxValue(tmp);
3497 PyObject *ret=PyTuple_New(2);
3498 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3499 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3503 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3506 int r1=self->getMinValue(tmp);
3507 PyObject *ret=PyTuple_New(2);
3508 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3509 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3513 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3515 int nbOfCompo=self->getNumberOfComponents();
3520 if(PyInt_Check(obj))
3522 int val=(int)PyInt_AS_LONG(obj);
3523 return self->findIdFirstEqual(val);
3526 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3530 std::vector<int> arr;
3531 convertPyToNewIntArr3(obj,arr);
3532 return self->findIdFirstEqualTuple(arr);
3537 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3539 int nbOfCompo=self->getNumberOfComponents();
3546 if(PyInt_Check(obj))
3548 int val=(int)PyInt_AS_LONG(obj);
3549 return self->presenceOfValue(val);
3552 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3556 std::vector<int> arr;
3557 convertPyToNewIntArr3(obj,arr);
3558 return self->presenceOfTuple(arr);
3563 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3565 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3566 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3567 self->checkAllocated();
3568 int nbOfTuples=self->getNumberOfTuples();
3569 int nbOfComponents=self->getNumberOfComponents();
3571 std::vector<int> vt1,vc1;
3572 std::pair<int, std::pair<int,int> > pt1,pc1;
3573 DataArrayInt *dt1=0,*dc1=0;
3575 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3576 MCAuto<DataArrayInt> ret;
3581 if(nbOfComponents==1)
3582 return PyInt_FromLong(self->getIJSafe(it1,0));
3583 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3586 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3588 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3590 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3592 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3595 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3596 std::vector<int> v2(1,ic1);
3597 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3601 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3602 std::vector<int> v2(1,ic1);
3603 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3607 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3608 std::vector<int> v2(1,ic1);
3609 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3613 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3614 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3618 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3619 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3623 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3624 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3628 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3629 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3633 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3634 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3635 std::vector<int> v2(nbOfComp);
3636 for(int i=0;i<nbOfComp;i++)
3637 v2[i]=pc1.first+i*pc1.second.second;
3638 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3642 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3643 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3644 std::vector<int> v2(nbOfComp);
3645 for(int i=0;i<nbOfComp;i++)
3646 v2[i]=pc1.first+i*pc1.second.second;
3647 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3651 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3652 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3653 std::vector<int> v2(nbOfComp);
3654 for(int i=0;i<nbOfComp;i++)
3655 v2[i]=pc1.first+i*pc1.second.second;
3656 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3660 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3661 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3662 std::vector<int> v2(nbOfComp);
3663 for(int i=0;i<nbOfComp;i++)
3664 v2[i]=pc1.first+i*pc1.second.second;
3665 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3668 throw INTERP_KERNEL::Exception(msg);
3672 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3674 self->checkAllocated();
3675 const char msg[]="Unexpected situation in __setitem__ !";
3676 int nbOfTuples=self->getNumberOfTuples();
3677 int nbOfComponents=self->getNumberOfComponents();
3680 std::vector<int> v1;
3682 DataArrayIntTuple *dd1=0;
3683 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3685 std::vector<int> vt1,vc1;
3686 std::pair<int, std::pair<int,int> > pt1,pc1;
3687 DataArrayInt *dt1=0,*dc1=0;
3688 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3689 MCAuto<DataArrayInt> tmp;
3697 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3700 tmp=DataArrayInt::New();
3701 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3702 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3705 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3708 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3709 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3712 throw INTERP_KERNEL::Exception(msg);
3721 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3724 tmp=DataArrayInt::New();
3725 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3726 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3729 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3732 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3733 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3736 throw INTERP_KERNEL::Exception(msg);
3745 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3748 tmp=DataArrayInt::New();
3749 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3750 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3753 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3756 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3757 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3760 throw INTERP_KERNEL::Exception(msg);
3769 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3772 tmp=DataArrayInt::New();
3773 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3774 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3777 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3780 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3781 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3784 throw INTERP_KERNEL::Exception(msg);
3793 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3796 tmp=DataArrayInt::New();
3797 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3798 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3801 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3804 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3805 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3808 throw INTERP_KERNEL::Exception(msg);
3817 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3820 tmp=DataArrayInt::New();
3821 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3822 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3825 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3828 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3829 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3832 throw INTERP_KERNEL::Exception(msg);
3841 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3844 tmp=DataArrayInt::New();
3845 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3846 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3849 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3852 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3853 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3856 throw INTERP_KERNEL::Exception(msg);
3865 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3868 tmp=DataArrayInt::New();
3869 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3870 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3873 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3876 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3877 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3880 throw INTERP_KERNEL::Exception(msg);
3889 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3892 tmp=DataArrayInt::New();
3893 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3894 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3897 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3900 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3901 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3904 throw INTERP_KERNEL::Exception(msg);
3913 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3916 tmp=DataArrayInt::New();
3917 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3918 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3921 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3924 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3925 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3928 throw INTERP_KERNEL::Exception(msg);
3937 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3940 tmp=DataArrayInt::New();
3941 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3942 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3945 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3948 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3949 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3952 throw INTERP_KERNEL::Exception(msg);
3961 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3964 tmp=DataArrayInt::New();
3965 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3966 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3969 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3972 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3973 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3976 throw INTERP_KERNEL::Exception(msg);
3985 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3988 tmp=DataArrayInt::New();
3989 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3990 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3993 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3996 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3997 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
4000 throw INTERP_KERNEL::Exception(msg);
4009 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
4012 tmp=DataArrayInt::New();
4013 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4014 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
4017 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
4020 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
4021 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
4024 throw INTERP_KERNEL::Exception(msg);
4033 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
4036 tmp=DataArrayInt::New();
4037 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4038 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
4041 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
4044 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
4045 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
4048 throw INTERP_KERNEL::Exception(msg);
4057 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
4060 tmp=DataArrayInt::New();
4061 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4062 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
4065 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
4068 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
4069 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
4072 throw INTERP_KERNEL::Exception(msg);
4077 throw INTERP_KERNEL::Exception(msg);
4082 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
4084 return self->negate();
4087 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4089 const char msg[]="Unexpected situation in __add__ !";
4092 std::vector<int> aa;
4093 DataArrayIntTuple *aaa;
4095 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4100 MCAuto<DataArrayInt> ret=self->deepCopy();
4101 ret->applyLin(1,val);
4106 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4107 return DataArrayInt::Add(self,aaaa);
4111 return DataArrayInt::Add(self,a);
4115 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4116 return DataArrayInt::Add(self,aaaa);
4119 throw INTERP_KERNEL::Exception(msg);
4123 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4125 const char msg[]="Unexpected situation in __radd__ !";
4128 std::vector<int> aa;
4129 DataArrayIntTuple *aaa;
4131 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4136 MCAuto<DataArrayInt> ret=self->deepCopy();
4137 ret->applyLin(1,val);
4142 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4143 return DataArrayInt::Add(self,aaaa);
4147 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4148 return DataArrayInt::Add(self,aaaa);
4151 throw INTERP_KERNEL::Exception(msg);
4155 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4157 const char msg[]="Unexpected situation in __iadd__ !";
4160 std::vector<int> aa;
4161 DataArrayIntTuple *aaa;
4163 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4168 self->applyLin(1,val);
4169 Py_XINCREF(trueSelf);
4174 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4176 Py_XINCREF(trueSelf);
4182 Py_XINCREF(trueSelf);
4187 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4188 self->addEqual(aaaa);
4189 Py_XINCREF(trueSelf);
4193 throw INTERP_KERNEL::Exception(msg);
4197 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4199 const char msg[]="Unexpected situation in __sub__ !";
4202 std::vector<int> aa;
4203 DataArrayIntTuple *aaa;
4205 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4210 MCAuto<DataArrayInt> ret=self->deepCopy();
4211 ret->applyLin(1,-val);
4216 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4217 return DataArrayInt::Substract(self,aaaa);
4221 return DataArrayInt::Substract(self,a);
4225 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4226 return DataArrayInt::Substract(self,aaaa);
4229 throw INTERP_KERNEL::Exception(msg);
4233 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4235 const char msg[]="Unexpected situation in __rsub__ !";
4238 std::vector<int> aa;
4239 DataArrayIntTuple *aaa;
4241 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4246 MCAuto<DataArrayInt> ret=self->deepCopy();
4247 ret->applyLin(-1,val);
4252 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4253 return DataArrayInt::Substract(aaaa,self);
4257 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4258 return DataArrayInt::Substract(aaaa,self);
4261 throw INTERP_KERNEL::Exception(msg);
4265 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4267 const char msg[]="Unexpected situation in __isub__ !";
4270 std::vector<int> aa;
4271 DataArrayIntTuple *aaa;
4273 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4278 self->applyLin(1,-val);
4279 Py_XINCREF(trueSelf);
4284 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4285 self->substractEqual(bb);
4286 Py_XINCREF(trueSelf);
4291 self->substractEqual(a);
4292 Py_XINCREF(trueSelf);
4297 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4298 self->substractEqual(aaaa);
4299 Py_XINCREF(trueSelf);
4303 throw INTERP_KERNEL::Exception(msg);
4307 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4309 const char msg[]="Unexpected situation in __mul__ !";
4312 std::vector<int> aa;
4313 DataArrayIntTuple *aaa;
4315 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4320 MCAuto<DataArrayInt> ret=self->deepCopy();
4321 ret->applyLin(val,0);
4326 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4327 return DataArrayInt::Multiply(self,aaaa);
4331 return DataArrayInt::Multiply(self,a);
4335 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4336 return DataArrayInt::Multiply(self,aaaa);
4339 throw INTERP_KERNEL::Exception(msg);
4343 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4345 const char msg[]="Unexpected situation in __rmul__ !";
4348 std::vector<int> aa;
4349 DataArrayIntTuple *aaa;
4351 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4356 MCAuto<DataArrayInt> ret=self->deepCopy();
4357 ret->applyLin(val,0);
4362 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4363 return DataArrayInt::Multiply(self,aaaa);
4367 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4368 return DataArrayInt::Multiply(self,aaaa);
4371 throw INTERP_KERNEL::Exception(msg);
4375 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4377 const char msg[]="Unexpected situation in __imul__ !";
4380 std::vector<int> aa;
4381 DataArrayIntTuple *aaa;
4383 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4388 self->applyLin(val,0);
4389 Py_XINCREF(trueSelf);
4394 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4395 self->multiplyEqual(bb);
4396 Py_XINCREF(trueSelf);
4401 self->multiplyEqual(a);
4402 Py_XINCREF(trueSelf);
4407 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4408 self->multiplyEqual(aaaa);
4409 Py_XINCREF(trueSelf);
4413 throw INTERP_KERNEL::Exception(msg);
4417 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4419 const char msg[]="Unexpected situation in __div__ !";
4422 std::vector<int> aa;
4423 DataArrayIntTuple *aaa;
4425 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4430 MCAuto<DataArrayInt> ret=self->deepCopy();
4431 ret->applyDivideBy(val);
4436 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4437 return DataArrayInt::Divide(self,aaaa);
4441 return DataArrayInt::Divide(self,a);
4445 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4446 return DataArrayInt::Divide(self,aaaa);
4449 throw INTERP_KERNEL::Exception(msg);
4453 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4455 const char msg[]="Unexpected situation in __rdiv__ !";
4458 std::vector<int> aa;
4459 DataArrayIntTuple *aaa;
4461 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4466 MCAuto<DataArrayInt> ret=self->deepCopy();
4472 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4473 return DataArrayInt::Divide(aaaa,self);
4477 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4478 return DataArrayInt::Divide(aaaa,self);
4481 throw INTERP_KERNEL::Exception(msg);
4485 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4487 const char msg[]="Unexpected situation in __idiv__ !";
4490 std::vector<int> aa;
4491 DataArrayIntTuple *aaa;
4493 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4498 self->applyDivideBy(val);
4499 Py_XINCREF(trueSelf);
4504 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4505 self->divideEqual(bb);
4506 Py_XINCREF(trueSelf);
4511 self->divideEqual(a);
4512 Py_XINCREF(trueSelf);
4517 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4518 self->divideEqual(aaaa);
4519 Py_XINCREF(trueSelf);
4523 throw INTERP_KERNEL::Exception(msg);
4527 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4529 const char msg[]="Unexpected situation in __mod__ !";
4532 std::vector<int> aa;
4533 DataArrayIntTuple *aaa;
4535 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4540 MCAuto<DataArrayInt> ret=self->deepCopy();
4541 ret->applyModulus(val);
4546 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4547 return DataArrayInt::Modulus(self,aaaa);
4551 return DataArrayInt::Modulus(self,a);
4555 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4556 return DataArrayInt::Modulus(self,aaaa);
4559 throw INTERP_KERNEL::Exception(msg);
4563 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4565 const char msg[]="Unexpected situation in __rmod__ !";
4568 std::vector<int> aa;
4569 DataArrayIntTuple *aaa;
4571 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4576 MCAuto<DataArrayInt> ret=self->deepCopy();
4577 ret->applyRModulus(val);
4582 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4583 return DataArrayInt::Modulus(aaaa,self);
4587 return DataArrayInt::Modulus(a,self);
4591 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4592 return DataArrayInt::Modulus(aaaa,self);
4595 throw INTERP_KERNEL::Exception(msg);
4599 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4601 const char msg[]="Unexpected situation in __imod__ !";
4604 std::vector<int> aa;
4605 DataArrayIntTuple *aaa;
4607 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4612 self->applyModulus(val);
4613 Py_XINCREF(trueSelf);
4618 self->modulusEqual(a);
4619 Py_XINCREF(trueSelf);
4624 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4625 self->modulusEqual(aaaa);
4626 Py_XINCREF(trueSelf);
4630 throw INTERP_KERNEL::Exception(msg);
4634 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4636 const char msg[]="Unexpected situation in __pow__ !";
4639 std::vector<int> aa;
4640 DataArrayIntTuple *aaa;
4642 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4647 MCAuto<DataArrayInt> ret=self->deepCopy();
4653 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4654 return DataArrayInt::Pow(self,aaaa);
4658 return DataArrayInt::Pow(self,a);
4662 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4663 return DataArrayInt::Pow(self,aaaa);
4666 throw INTERP_KERNEL::Exception(msg);
4670 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4672 const char msg[]="Unexpected situation in __rpow__ !";
4675 std::vector<int> aa;
4676 DataArrayIntTuple *aaa;
4678 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4683 MCAuto<DataArrayInt> ret=self->deepCopy();
4684 ret->applyRPow(val);
4689 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4690 return DataArrayInt::Pow(aaaa,self);
4694 return DataArrayInt::Pow(a,self);
4698 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4699 return DataArrayInt::Pow(aaaa,self);
4702 throw INTERP_KERNEL::Exception(msg);
4706 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4708 const char msg[]="Unexpected situation in __ipow__ !";
4711 std::vector<int> aa;
4712 DataArrayIntTuple *aaa;
4714 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4719 self->applyPow(val);
4720 Py_XINCREF(trueSelf);
4726 Py_XINCREF(trueSelf);
4731 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4732 self->powEqual(aaaa);
4733 Py_XINCREF(trueSelf);
4737 throw INTERP_KERNEL::Exception(msg);
4741 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4743 std::ostringstream oss;
4744 self->reprQuickOverview(oss);
4748 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4750 int szArr,sw,iTypppArr;
4751 std::vector<int> stdvecTyyppArr;
4752 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4753 self->pushBackValsSilent(tmp,tmp+szArr);
4756 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4758 std::vector<int> ret1;
4759 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4760 std::size_t sz=ret0.size();
4761 PyObject *pyRet=PyTuple_New(2);
4762 PyObject *pyRet0=PyList_New((int)sz);
4763 PyObject *pyRet1=PyList_New((int)sz);
4764 for(std::size_t i=0;i<sz;i++)
4766 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4767 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4769 PyTuple_SetItem(pyRet,0,pyRet0);
4770 PyTuple_SetItem(pyRet,1,pyRet1);
4774 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4776 DataArrayInt *ret0=0,*ret1=0;
4777 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4778 PyObject *pyRet=PyTuple_New(2);
4779 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4780 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4784 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4787 bool ret(self->isRange(a,b,c));
4788 PyObject *pyRet=PyTuple_New(2);
4789 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4791 PyTuple_SetItem(pyRet,0,ret0Py);
4793 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4799 PyTuple_SetItem(pyRet,1,ret1Py);
4804 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4806 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4809 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4812 if(!self->isAllocated())
4813 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4814 PyObject *ret(PyTuple_New(1));
4815 PyObject *ret0(PyDict_New());
4816 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4817 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4818 PyObject *tmp1(PyInt_FromLong(0));
4819 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4820 PyTuple_SetItem(ret,0,ret0);
4824 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4830 class DataArrayIntTuple;
4832 class DataArrayIntIterator
4835 DataArrayIntIterator(DataArrayInt *da);
4836 ~DataArrayIntIterator();
4841 DataArrayIntTuple *ret=self->nextt();
4843 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4846 PyErr_SetString(PyExc_StopIteration,"No more data.");
4853 class DataArrayIntTuple
4856 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4857 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4860 std::string __str__() const throw(INTERP_KERNEL::Exception)
4862 return self->repr();
4865 int __int__() const throw(INTERP_KERNEL::Exception)
4867 return self->intValue();
4870 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4872 return self->buildDAInt(1,self->getNumberOfCompo());
4875 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4877 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4878 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4879 Py_XINCREF(trueSelf);
4883 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4885 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4886 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4887 Py_XINCREF(trueSelf);
4891 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4893 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4894 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4895 Py_XINCREF(trueSelf);
4899 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4901 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4902 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4903 Py_XINCREF(trueSelf);
4907 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4909 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4910 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4911 Py_XINCREF(trueSelf);
4915 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4917 return PyInt_FromLong(self->getNumberOfCompo());
4920 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4922 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4925 std::vector<int> multiVal;
4926 std::pair<int, std::pair<int,int> > slic;
4927 MEDCoupling::DataArrayInt *daIntTyypp=0;
4928 const int *pt=self->getConstPointer();
4929 int nbc=self->getNumberOfCompo();
4930 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4937 std::ostringstream oss;
4938 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4939 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4943 return PyInt_FromLong(pt[singleVal]);
4947 return PyInt_FromLong(pt[nbc+singleVal]);
4950 std::ostringstream oss;
4951 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4952 throw INTERP_KERNEL::Exception(oss.str().c_str());
4958 PyObject *t=PyTuple_New(multiVal.size());
4959 for(int j=0;j<(int)multiVal.size();j++)
4961 int cid=multiVal[j];
4964 std::ostringstream oss;
4965 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4966 throw INTERP_KERNEL::Exception(oss.str().c_str());
4968 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4974 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4975 PyObject *t=PyTuple_New(sz);
4976 for(int j=0;j<sz;j++)
4977 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4981 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4985 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4987 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4988 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4991 std::vector<int> multiValV;
4992 std::pair<int, std::pair<int,int> > slicV;
4993 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4994 int nbc=self->getNumberOfCompo();
4995 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4997 std::vector<int> multiVal;
4998 std::pair<int, std::pair<int,int> > slic;
4999 MEDCoupling::DataArrayInt *daIntTyypp=0;
5000 int *pt=self->getPointer();
5001 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
5008 std::ostringstream oss;
5009 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
5010 throw INTERP_KERNEL::Exception(oss.str().c_str());
5016 pt[singleVal]=singleValV;
5021 if(multiValV.size()!=1)
5023 std::ostringstream oss;
5024 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
5025 throw INTERP_KERNEL::Exception(oss.str().c_str());
5027 pt[singleVal]=multiValV[0];
5032 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
5036 throw INTERP_KERNEL::Exception(msg);
5045 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
5049 std::ostringstream oss;
5050 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
5051 throw INTERP_KERNEL::Exception(oss.str().c_str());
5059 if(multiVal.size()!=multiValV.size())
5061 std::ostringstream oss;
5062 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
5063 throw INTERP_KERNEL::Exception(oss.str().c_str());
5065 for(int i=0;i<(int)multiVal.size();i++)
5067 int pos=multiVal[i];
5070 std::ostringstream oss;
5071 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
5072 throw INTERP_KERNEL::Exception(oss.str().c_str());
5074 pt[multiVal[i]]=multiValV[i];
5080 const int *ptV=daIntTyyppV->getConstPointer();
5081 if(nbc>daIntTyyppV->getNumberOfCompo())
5083 std::ostringstream oss;
5084 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
5085 throw INTERP_KERNEL::Exception(oss.str().c_str());
5087 std::copy(ptV,ptV+nbc,pt);
5091 throw INTERP_KERNEL::Exception(msg);
5096 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
5101 for(int j=0;j<sz;j++)
5102 pt[slic.first+j*slic.second.second]=singleValV;
5107 if(sz!=(int)multiValV.size())
5109 std::ostringstream oss;
5110 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
5111 throw INTERP_KERNEL::Exception(oss.str().c_str());
5113 for(int j=0;j<sz;j++)
5114 pt[slic.first+j*slic.second.second]=multiValV[j];
5119 const int *ptV=daIntTyyppV->getConstPointer();
5120 if(sz>daIntTyyppV->getNumberOfCompo())
5122 std::ostringstream oss;
5123 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
5124 throw INTERP_KERNEL::Exception(oss.str().c_str());
5126 for(int j=0;j<sz;j++)
5127 pt[slic.first+j*slic.second.second]=ptV[j];
5131 throw INTERP_KERNEL::Exception(msg);
5135 throw INTERP_KERNEL::Exception(msg);
5141 class DataArrayChar : public DataArray
5144 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
5145 int getHashCode() const throw(INTERP_KERNEL::Exception);
5146 bool empty() const throw(INTERP_KERNEL::Exception);
5147 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
5148 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
5149 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
5150 char popBackSilent() throw(INTERP_KERNEL::Exception);
5151 void pack() const throw(INTERP_KERNEL::Exception);
5152 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
5153 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
5154 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
5155 void reverse() throw(INTERP_KERNEL::Exception);
5156 void fillWithZero() throw(INTERP_KERNEL::Exception);
5157 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
5158 std::string repr() const throw(INTERP_KERNEL::Exception);
5159 std::string reprZip() const throw(INTERP_KERNEL::Exception);
5160 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
5161 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
5162 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
5163 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
5164 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
5165 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
5166 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
5167 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
5168 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
5169 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
5170 char front() const throw(INTERP_KERNEL::Exception);
5171 char back() const throw(INTERP_KERNEL::Exception);
5172 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
5173 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
5174 char *getPointer() throw(INTERP_KERNEL::Exception);
5175 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
5176 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
5177 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
5178 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
5179 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
5180 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
5181 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
5182 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
5183 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
5184 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
5185 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
5188 int __len__() const throw(INTERP_KERNEL::Exception)
5190 if(self->isAllocated())
5192 return self->getNumberOfTuples();
5196 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
5200 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
5203 bool ret0=self->isEqualIfNotWhy(other,ret1);
5204 PyObject *ret=PyTuple_New(2);
5205 PyObject *ret0Py=ret0?Py_True:Py_False;
5207 PyTuple_SetItem(ret,0,ret0Py);
5208 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5212 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5215 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5216 if (!SWIG_IsOK(res1))
5219 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5220 if(size!=self->getNumberOfTuples())
5222 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5224 return self->renumber(tmp);
5228 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5230 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5231 da2->checkAllocated();
5232 int size=self->getNumberOfTuples();
5233 if(size!=self->getNumberOfTuples())
5235 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5237 return self->renumber(da2->getConstPointer());
5241 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5244 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5245 if (!SWIG_IsOK(res1))
5248 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5249 if(size!=self->getNumberOfTuples())
5251 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5253 return self->renumberR(tmp);
5257 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5259 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5260 da2->checkAllocated();
5261 int size=self->getNumberOfTuples();
5262 if(size!=self->getNumberOfTuples())
5264 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5266 return self->renumberR(da2->getConstPointer());
5270 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5273 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5274 if (!SWIG_IsOK(res1))
5277 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5278 if(size!=self->getNumberOfTuples())
5280 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5282 return self->renumberAndReduce(tmp,newNbOfTuple);
5286 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5288 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5289 da2->checkAllocated();
5290 int size=self->getNumberOfTuples();
5291 if(size!=self->getNumberOfTuples())
5293 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5295 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5299 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5301 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5302 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5303 return DataArrayChar::Aggregate(tmp);
5306 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5308 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5309 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5310 return DataArrayChar::Meld(tmp);
5315 class DataArrayByteIterator;
5317 class DataArrayByte : public DataArrayChar
5320 static DataArrayByte *New();
5321 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5322 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5323 char byteValue() const throw(INTERP_KERNEL::Exception);
5326 DataArrayByte() throw(INTERP_KERNEL::Exception)
5328 return DataArrayByte::New();
5331 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5333 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) !";
5334 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5338 if(PyInt_Check(nbOfTuples))
5340 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5342 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5345 if(PyInt_Check(nbOfComp))
5346 {//DataArrayByte.New([1,3,4,5],2,2)
5347 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5349 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5350 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5351 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5352 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5356 throw INTERP_KERNEL::Exception(msg);
5359 {//DataArrayByte.New([1,3,4],3)
5360 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5362 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5363 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5368 throw INTERP_KERNEL::Exception(msg);
5371 {// DataArrayByte.New([1,3,4])
5372 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5373 int tmpp1=-1,tmpp2=-1;
5374 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5375 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5379 else if(PyInt_Check(elt0))
5381 int nbOfTuples1=PyInt_AS_LONG(elt0);
5383 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5388 if(PyInt_Check(nbOfTuples))
5389 {//DataArrayByte.New(5,2)
5390 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5392 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5393 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5394 ret->alloc(nbOfTuples1,nbOfCompo);
5398 throw INTERP_KERNEL::Exception(msg);
5401 throw INTERP_KERNEL::Exception(msg);
5404 {//DataArrayByte.New(5)
5405 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5406 ret->alloc(nbOfTuples1,1);
5411 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
5412 {//DataArrayDouble.New(numpyArray)
5413 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
5417 throw INTERP_KERNEL::Exception(msg);
5420 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5422 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5425 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5427 std::ostringstream oss;
5428 self->reprQuickOverview(oss);
5432 int __int__() const throw(INTERP_KERNEL::Exception)
5434 return (int) self->byteValue();
5437 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5439 return self->iterator();
5442 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5444 return (int)self->getIJ(tupleId,compoId);
5447 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5449 return (int)self->getIJSafe(tupleId,compoId);
5452 std::string __str__() const throw(INTERP_KERNEL::Exception)
5454 return self->repr();
5457 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5459 const char *vals=self->getConstPointer();
5460 int nbOfComp=self->getNumberOfComponents();
5461 int nbOfTuples=self->getNumberOfTuples();
5462 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5465 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5468 int ival=-1; std::vector<int> ivval;
5469 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5470 std::vector<char> vals(sz);
5471 std::copy(pt,pt+sz,vals.begin());
5472 return self->presenceOfTuple(vals);
5475 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5478 int ival=-1; std::vector<int> ivval;
5479 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5480 std::vector<char> vals2(sz);
5481 std::copy(pt,pt+sz,vals2.begin());
5482 return self->presenceOfValue(vals2);
5485 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5488 int ival=-1; std::vector<int> ivval;
5489 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5490 std::vector<char> vals2(sz);
5491 std::copy(pt,pt+sz,vals2.begin());
5492 return self->findIdFirstEqual(vals2);
5495 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5498 int ival=-1; std::vector<int> ivval;
5499 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5500 std::vector<char> vals(sz);
5501 std::copy(pt,pt+sz,vals.begin());
5502 return self->findIdFirstEqualTuple(vals);
5505 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5508 int ival=-1; std::vector<int> ivval;
5509 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5510 std::vector<char> vals(sz);
5511 std::copy(pt,pt+sz,vals.begin());
5512 return self->findIdSequence(vals);
5515 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5517 int sz=self->getNumberOfComponents();
5518 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5519 self->getTuple(tupleId,tmp);
5520 PyObject *ret=PyTuple_New(sz);
5521 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5525 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5528 int r1=(int)self->getMaxValue(tmp);
5529 PyObject *ret=PyTuple_New(2);
5530 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5531 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5535 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5538 int r1=(int)self->getMinValue(tmp);
5539 PyObject *ret=PyTuple_New(2);
5540 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5541 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5545 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5547 int nbOfCompo=self->getNumberOfComponents();
5552 if(PyInt_Check(obj))
5554 int val=(int)PyInt_AS_LONG(obj);
5555 return self->findIdFirstEqual(val);
5558 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5561 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5565 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5567 int nbOfCompo=self->getNumberOfComponents();
5574 if(PyInt_Check(obj))
5576 int val=(int)PyInt_AS_LONG(obj);
5577 return self->presenceOfValue(val);
5580 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5583 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5588 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5590 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5595 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5597 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5600 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5603 if(!self->isAllocated())
5604 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5605 PyObject *ret(PyTuple_New(1));
5606 PyObject *ret0(PyDict_New());
5607 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5608 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5609 PyObject *tmp1(PyInt_FromLong(0));
5610 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5611 PyTuple_SetItem(ret,0,ret0);
5615 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5619 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5621 self->checkAllocated();
5622 const char msg[]="Unexpected situation in __setitem__ !";
5623 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5626 std::vector<int> v1;
5628 DataArrayIntTuple *dd1=0;
5629 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5631 std::vector<int> vt1,vc1;
5632 std::pair<int, std::pair<int,int> > pt1,pc1;
5633 DataArrayInt *dt1=0,*dc1=0;
5634 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5635 MCAuto<DataArrayInt> tmp;
5643 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5646 throw INTERP_KERNEL::Exception(msg);
5655 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5658 throw INTERP_KERNEL::Exception(msg);
5667 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5670 throw INTERP_KERNEL::Exception(msg);
5679 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5682 throw INTERP_KERNEL::Exception(msg);
5691 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5694 throw INTERP_KERNEL::Exception(msg);
5703 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5706 throw INTERP_KERNEL::Exception(msg);
5715 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5718 throw INTERP_KERNEL::Exception(msg);
5727 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5730 throw INTERP_KERNEL::Exception(msg);
5739 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5742 throw INTERP_KERNEL::Exception(msg);
5751 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5754 throw INTERP_KERNEL::Exception(msg);
5763 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5766 throw INTERP_KERNEL::Exception(msg);
5775 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5778 throw INTERP_KERNEL::Exception(msg);
5787 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5790 throw INTERP_KERNEL::Exception(msg);
5799 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5802 throw INTERP_KERNEL::Exception(msg);
5811 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5814 throw INTERP_KERNEL::Exception(msg);
5823 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5826 throw INTERP_KERNEL::Exception(msg);
5831 throw INTERP_KERNEL::Exception(msg);
5838 class DataArrayByteTuple;
5840 class DataArrayByteIterator
5843 DataArrayByteIterator(DataArrayByte *da);
5844 ~DataArrayByteIterator();
5847 class DataArrayByteTuple
5850 std::string repr() const throw(INTERP_KERNEL::Exception);
5851 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5854 std::string __str__() const throw(INTERP_KERNEL::Exception)
5856 return self->repr();
5859 char __int__() const throw(INTERP_KERNEL::Exception)
5861 return self->byteValue();
5864 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5866 return self->buildDAByte(1,self->getNumberOfCompo());
5871 class DataArrayAsciiCharIterator;
5873 class DataArrayAsciiChar : public DataArrayChar
5876 static DataArrayAsciiChar *New();
5877 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5878 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5879 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5882 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5884 return DataArrayAsciiChar::New();
5887 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5889 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) !";
5890 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5894 if(PyInt_Check(nbOfTuples))
5896 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5898 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5901 if(PyInt_Check(nbOfComp))
5902 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5903 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5905 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5906 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5907 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5908 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5912 throw INTERP_KERNEL::Exception(msg);
5915 {//DataArrayAsciiChar.New([1,3,4],3)
5916 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5918 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5919 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5923 else if(PyString_Check(nbOfTuples))
5925 if(PyString_Size(nbOfTuples)!=1)
5926 throw INTERP_KERNEL::Exception(msg);
5927 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5928 std::vector<std::string> tmp;
5929 if(fillStringVector(elt0,tmp))
5930 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5932 throw INTERP_KERNEL::Exception(msg);
5935 throw INTERP_KERNEL::Exception(msg);
5939 std::vector<std::string> tmmp;
5940 if(fillStringVector(elt0,tmmp))
5941 //DataArrayAsciiChar.New(["abc","de","fghi"])
5942 return DataArrayAsciiChar::New(tmmp,' ');
5945 // DataArrayAsciiChar.New([1,3,4])
5946 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5947 int tmpp1=-1,tmpp2=-1;
5948 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5949 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5954 else if(PyInt_Check(elt0))
5956 int nbOfTuples1=PyInt_AS_LONG(elt0);
5958 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5963 if(PyInt_Check(nbOfTuples))
5964 {//DataArrayAsciiChar.New(5,2)
5965 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5967 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5968 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5969 ret->alloc(nbOfTuples1,nbOfCompo);
5973 throw INTERP_KERNEL::Exception(msg);
5976 throw INTERP_KERNEL::Exception(msg);
5979 {//DataArrayAsciiChar.New(5)
5980 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5981 ret->alloc(nbOfTuples1,1);
5986 throw INTERP_KERNEL::Exception(msg);
5989 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5991 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5994 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5996 std::ostringstream oss;
5997 self->reprQuickOverview(oss);
6001 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
6003 return self->iterator();
6006 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
6008 char tmp[2]; tmp[1]='\0';
6009 tmp[0]=self->getIJ(tupleId,compoId);
6010 return std::string(tmp);
6013 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
6015 char tmp[2]; tmp[1]='\0';
6016 tmp[0]=self->getIJSafe(tupleId,compoId);
6017 return std::string(tmp);
6020 std::string __str__() const throw(INTERP_KERNEL::Exception)
6022 return self->repr();
6025 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
6027 const char *vals=self->getConstPointer();
6028 int nbOfComp=self->getNumberOfComponents();
6029 int nbOfTuples=self->getNumberOfTuples();
6030 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
6033 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
6035 if(PyString_Check(tupl))
6037 Py_ssize_t sz=PyString_Size(tupl);
6038 std::vector<char> vals(sz);
6039 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
6040 return self->presenceOfTuple(vals);
6043 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
6046 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
6048 if(PyString_Check(vals))
6050 Py_ssize_t sz=PyString_Size(vals);
6051 std::vector<char> vals2(sz);
6052 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
6053 return self->presenceOfValue(vals2);
6056 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
6059 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
6061 if(PyString_Check(vals))
6063 Py_ssize_t sz=PyString_Size(vals);
6064 std::vector<char> vals2(sz);
6065 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
6066 return self->findIdFirstEqual(vals2);
6069 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
6072 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
6074 if(PyString_Check(tupl))
6076 Py_ssize_t sz=PyString_Size(tupl);
6077 std::vector<char> vals(sz);
6078 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
6079 return self->findIdFirstEqualTuple(vals);
6082 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
6085 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
6087 if(PyString_Check(strOrListOfInt))
6089 Py_ssize_t sz=PyString_Size(strOrListOfInt);
6090 std::vector<char> vals(sz);
6091 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
6092 return self->findIdSequence(vals);
6095 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
6098 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
6100 int sz=self->getNumberOfComponents();
6101 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
6102 self->getTuple(tupleId,tmp);
6103 return PyString_FromString(tmp);
6106 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
6109 char tmp2[2]; tmp2[1]='\0';
6110 tmp2[0]=self->getMaxValue(tmp);
6111 PyObject *ret=PyTuple_New(2);
6112 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
6113 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
6117 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
6120 char tmp2[2]; tmp2[1]='\0';
6121 tmp2[0]=self->getMinValue(tmp);
6122 PyObject *ret=PyTuple_New(2);
6123 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
6124 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
6128 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
6130 int nbOfCompo=self->getNumberOfComponents();
6135 if(PyString_Check(obj))
6137 Py_ssize_t sz=PyString_Size(obj);
6138 char *pt=PyString_AsString(obj);
6140 return self->findIdFirstEqual(pt[0]);
6142 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
6145 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
6148 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
6152 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
6154 int nbOfCompo=self->getNumberOfComponents();
6161 if(PyString_Check(obj))
6163 Py_ssize_t sz=PyString_Size(obj);
6164 char *pt=PyString_AsString(obj);
6166 return self->presenceOfValue(pt[0]);
6168 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
6171 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
6174 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
6178 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
6181 std::vector<int> stdvecTyyppArr;
6182 std::pair<int, std::pair<int,int> > sTyyppArr;
6183 MEDCoupling::DataArrayInt *daIntTyypp=0;
6184 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
6188 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
6190 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
6192 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
6194 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
6196 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
6200 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
6202 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.";
6204 std::vector<int> stdvecTyyppArr;
6205 std::pair<int, std::pair<int,int> > sTyyppArr;
6206 MEDCoupling::DataArrayInt *daIntTyypp=0;
6207 int nbOfCompo=self->getNumberOfComponents();
6208 int nbOfTuples=self->getNumberOfTuples();
6209 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
6211 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
6212 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
6221 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
6227 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6228 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6231 //value vector<string>
6234 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6235 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6238 //value DataArrayChar
6241 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6245 throw INTERP_KERNEL::Exception(msg);
6249 {//obj list-tuple[int]
6255 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6261 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6262 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6265 //value vector<string>
6268 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6269 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6272 //value DataArrayChar
6275 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6279 throw INTERP_KERNEL::Exception(msg);
6290 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6296 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6297 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6300 //value vector<string>
6303 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6304 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6307 //value DataArrayChar
6310 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6314 throw INTERP_KERNEL::Exception(msg);
6325 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6331 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6332 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6335 //value vector<string>
6338 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6339 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6342 //value DataArrayChar
6345 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6349 throw INTERP_KERNEL::Exception(msg);
6354 throw INTERP_KERNEL::Exception(msg);
6360 class DataArrayAsciiCharTuple;
6362 class DataArrayAsciiCharIterator
6365 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6366 ~DataArrayAsciiCharIterator();
6371 DataArrayAsciiCharTuple *ret=self->nextt();
6373 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6376 PyErr_SetString(PyExc_StopIteration,"No more data.");
6383 class DataArrayAsciiCharTuple
6386 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6387 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6390 std::string __str__() const throw(INTERP_KERNEL::Exception)
6392 return self->repr();
6395 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6397 return self->buildDAAsciiChar(1,self->getNumberOfCompo());