1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
22 %typemap(out) MEDCoupling::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) MEDCoupling::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
45 %newobject MEDCoupling::DataArray::deepCopy;
46 %newobject MEDCoupling::DataArray::buildNewEmptyInstance;
47 %newobject MEDCoupling::DataArray::selectByTupleRanges;
48 %newobject MEDCoupling::DataArray::selectByTupleId;
49 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
50 %newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
51 %newobject MEDCoupling::DataArray::Aggregate;
52 %newobject MEDCoupling::DataArrayFloat::New;
53 %newobject MEDCoupling::DataArrayInt::New;
54 %newobject MEDCoupling::DataArrayInt::__iter__;
55 %newobject MEDCoupling::DataArrayInt::selectPartDef;
56 %newobject MEDCoupling::DataArrayInt::convertToDblArr;
57 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
58 %newobject MEDCoupling::DataArrayInt::subArray;
59 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
60 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
61 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
62 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
63 %newobject MEDCoupling::DataArrayInt::renumber;
64 %newobject MEDCoupling::DataArrayInt::renumberR;
65 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
66 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
67 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
68 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
69 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
70 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
71 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
72 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
73 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
74 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
75 %newobject MEDCoupling::DataArrayInt::negate;
76 %newobject MEDCoupling::DataArrayInt::computeAbs;
77 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
78 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
79 %newobject MEDCoupling::DataArrayInt::findIdsStricltyNegative;
80 %newobject MEDCoupling::DataArrayInt::Aggregate;
81 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
82 %newobject MEDCoupling::DataArrayInt::Meld;
83 %newobject MEDCoupling::DataArrayInt::Add;
84 %newobject MEDCoupling::DataArrayInt::Substract;
85 %newobject MEDCoupling::DataArrayInt::Multiply;
86 %newobject MEDCoupling::DataArrayInt::Divide;
87 %newobject MEDCoupling::DataArrayInt::Pow;
88 %newobject MEDCoupling::DataArrayInt::BuildUnion;
89 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
90 %newobject MEDCoupling::DataArrayInt::Range;
91 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
92 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
93 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
94 %newobject MEDCoupling::DataArrayInt::buildComplement;
95 %newobject MEDCoupling::DataArrayInt::buildUnion;
96 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
97 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
98 %newobject MEDCoupling::DataArrayInt::buildIntersection;
99 %newobject MEDCoupling::DataArrayInt::buildUnique;
100 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
101 %newobject MEDCoupling::DataArrayInt::fromLinkedListOfPairToList;
102 %newobject MEDCoupling::DataArrayInt::findIdsGreaterOrEqualTo;
103 %newobject MEDCoupling::DataArrayInt::findIdsGreaterThan;
104 %newobject MEDCoupling::DataArrayInt::findIdsLowerOrEqualTo;
105 %newobject MEDCoupling::DataArrayInt::findIdsLowerThan;
106 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
107 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
108 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
109 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
110 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
111 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
112 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
113 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
114 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
115 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
116 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
117 %newobject MEDCoupling::DataArrayInt::__neg__;
118 %newobject MEDCoupling::DataArrayInt::__add__;
119 %newobject MEDCoupling::DataArrayInt::__radd__;
120 %newobject MEDCoupling::DataArrayInt::__sub__;
121 %newobject MEDCoupling::DataArrayInt::__rsub__;
122 %newobject MEDCoupling::DataArrayInt::__mul__;
123 %newobject MEDCoupling::DataArrayInt::__rmul__;
124 %newobject MEDCoupling::DataArrayInt::__div__;
125 %newobject MEDCoupling::DataArrayInt::__rdiv__;
126 %newobject MEDCoupling::DataArrayInt::__mod__;
127 %newobject MEDCoupling::DataArrayInt::__rmod__;
128 %newobject MEDCoupling::DataArrayInt::__pow__;
129 %newobject MEDCoupling::DataArrayInt::__rpow__;
130 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
131 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
132 %newobject MEDCoupling::DataArrayChar::renumber;
133 %newobject MEDCoupling::DataArrayChar::renumberR;
134 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
135 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
136 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
137 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
138 %newobject MEDCoupling::DataArrayChar::Aggregate;
139 %newobject MEDCoupling::DataArrayChar::Meld;
140 %newobject MEDCoupling::DataArrayByte::New;
141 %newobject MEDCoupling::DataArrayByte::__iter__;
142 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
143 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
144 %newobject MEDCoupling::DataArrayChar::subArray;
145 %newobject MEDCoupling::DataArrayAsciiChar::New;
146 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
147 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
148 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
149 %newobject MEDCoupling::DataArrayDouble::New;
150 %newobject MEDCoupling::DataArrayDouble::__iter__;
151 %newobject MEDCoupling::DataArrayDouble::selectPartDef;
152 %newobject MEDCoupling::DataArrayDouble::convertToIntArr;
153 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
154 %newobject MEDCoupling::DataArrayDouble::Aggregate;
155 %newobject MEDCoupling::DataArrayDouble::Meld;
156 %newobject MEDCoupling::DataArrayDouble::Dot;
157 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
158 %newobject MEDCoupling::DataArrayDouble::Add;
159 %newobject MEDCoupling::DataArrayDouble::Substract;
160 %newobject MEDCoupling::DataArrayDouble::Multiply;
161 %newobject MEDCoupling::DataArrayDouble::Divide;
162 %newobject MEDCoupling::DataArrayDouble::Pow;
163 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
164 %newobject MEDCoupling::DataArrayDouble::subArray;
165 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
166 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
167 %newobject MEDCoupling::DataArrayDouble::cumSum;
168 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
169 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
170 %newobject MEDCoupling::DataArrayDouble::negate;
171 %newobject MEDCoupling::DataArrayDouble::computeAbs;
172 %newobject MEDCoupling::DataArrayDouble::applyFunc;
173 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
174 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
175 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
176 %newobject MEDCoupling::DataArrayDouble::determinant;
177 %newobject MEDCoupling::DataArrayDouble::eigenValues;
178 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
179 %newobject MEDCoupling::DataArrayDouble::inverse;
180 %newobject MEDCoupling::DataArrayDouble::trace;
181 %newobject MEDCoupling::DataArrayDouble::deviator;
182 %newobject MEDCoupling::DataArrayDouble::magnitude;
183 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
184 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
185 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
186 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
187 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
188 %newobject MEDCoupling::DataArrayDouble::renumber;
189 %newobject MEDCoupling::DataArrayDouble::renumberR;
190 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
191 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
192 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
193 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
194 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
195 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
196 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
197 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
198 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
199 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
200 %newobject MEDCoupling::DataArrayDouble::cartesianize;
201 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
202 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
203 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
204 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
205 %newobject MEDCoupling::DataArrayDouble::__neg__;
206 %newobject MEDCoupling::DataArrayDouble::__radd__;
207 %newobject MEDCoupling::DataArrayDouble::__rsub__;
208 %newobject MEDCoupling::DataArrayDouble::__rmul__;
209 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
210 %newobject MEDCoupling::DataArrayDouble::__pow__;
211 %newobject MEDCoupling::DataArrayDouble::__rpow__;
212 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
214 %newobject MEDCoupling::PartDefinition::New;
215 %newobject MEDCoupling::PartDefinition::toDAI;
216 %newobject MEDCoupling::PartDefinition::__add__;
217 %newobject MEDCoupling::PartDefinition::composeWith;
218 %newobject MEDCoupling::PartDefinition::tryToSimplify;
219 %newobject MEDCoupling::DataArrayPartDefinition::New;
220 %newobject MEDCoupling::SlicePartDefinition::New;
223 %feature("unref") DataArray "$this->decrRef();"
224 %feature("unref") DataArrayDouble "$this->decrRef();"
225 %feature("unref") DataArrayInt "$this->decrRef();"
226 %feature("unref") DataArrayChar "$this->decrRef();"
227 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
228 %feature("unref") DataArrayByte "$this->decrRef();"
230 %feature("unref") PartDefinition "$this->decrRef();"
231 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
232 %feature("unref") SlicePartDefinition "$this->decrRef();"
234 namespace MEDCoupling
241 } MEDCouplingAxisType;
245 class PartDefinition : public RefCountObject, public TimeLabel
248 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
249 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
250 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
251 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
252 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
253 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
254 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
255 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
258 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
260 return (*self)+other;
263 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
266 bool ret0(self->isEqual(other,ret1));
267 PyObject *ret=PyTuple_New(2);
268 PyObject *ret0Py=ret0?Py_True:Py_False;
270 PyTuple_SetItem(ret,0,ret0Py);
271 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
275 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
277 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
281 virtual ~PartDefinition();
284 class DataArrayPartDefinition : public PartDefinition
287 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
290 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
292 return DataArrayPartDefinition::New(listOfIds);
295 std::string __str__() const throw(INTERP_KERNEL::Exception)
297 return self->getRepr();
300 std::string __repr__() const throw(INTERP_KERNEL::Exception)
302 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
303 oss << self->getRepr();
308 virtual ~DataArrayPartDefinition();
311 class SlicePartDefinition : public PartDefinition
314 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
315 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
318 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
320 return SlicePartDefinition::New(start,stop,step);
323 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
326 self->getSlice(a,b,c);
327 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
330 std::string __str__() const throw(INTERP_KERNEL::Exception)
332 return self->getRepr();
335 std::string __repr__() const throw(INTERP_KERNEL::Exception)
337 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
338 oss << self->getRepr();
343 virtual ~SlicePartDefinition();
346 class DataArray : public RefCountObject, public TimeLabel
349 void setName(const std::string& name);
350 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
351 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
352 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
353 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
354 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
355 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
356 std::string getName() const;
357 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
358 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
359 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
360 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
361 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
362 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
363 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
364 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
365 int getNumberOfComponents() const;
366 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
367 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
368 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
369 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
370 virtual void desallocate() throw(INTERP_KERNEL::Exception);
371 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
372 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
373 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
374 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
375 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
376 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
377 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
378 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
379 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
380 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
381 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
382 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
383 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
384 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
385 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
386 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
387 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
388 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
389 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
390 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
391 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
392 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
393 void updateTime() const;
396 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
398 const std::vector<std::string>& comps=self->getInfoOnComponents();
399 PyObject *ret=PyList_New((int)comps.size());
400 for(int i=0;i<(int)comps.size();i++)
401 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
405 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
407 std::vector<int> tmp;
408 convertPyToNewIntArr3(li,tmp);
409 self->copyPartOfStringInfoFrom(other,tmp);
412 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
414 std::vector<int> tmp;
415 convertPyToNewIntArr3(li,tmp);
416 self->copyPartOfStringInfoFrom2(tmp,other);
419 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
422 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
423 if (!SWIG_IsOK(res1))
426 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
427 if(size!=self->getNumberOfTuples())
429 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
431 self->renumberInPlace(tmp);
435 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
437 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
438 da2->checkAllocated();
439 int size=self->getNumberOfTuples();
440 if(size!=self->getNumberOfTuples())
442 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
444 self->renumberInPlace(da2->getConstPointer());
448 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
451 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
452 if (!SWIG_IsOK(res1))
455 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
456 if(size!=self->getNumberOfTuples())
458 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
460 self->renumberInPlaceR(tmp);
464 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
466 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
467 da2->checkAllocated();
468 int size=self->getNumberOfTuples();
469 if(size!=self->getNumberOfTuples())
471 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
473 self->renumberInPlaceR(da2->getConstPointer());
477 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
478 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
480 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
481 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
482 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
483 DataArrayInt *tuplesSelecPtr2=0;
486 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
488 throw INTERP_KERNEL::Exception(msg);
490 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
493 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
495 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
496 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
499 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
501 std::vector<std::pair<int,int> > ranges;
502 convertPyToVectorPairInt(li,ranges);
503 return self->selectByTupleRanges(ranges);
506 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
509 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
510 if (!SWIG_IsOK(res1))
513 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
514 return self->selectByTupleId(tmp,tmp+size);
518 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
520 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
521 da2->checkAllocated();
522 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
526 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
529 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
530 if (!SWIG_IsOK(res1))
533 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
534 return self->selectByTupleIdSafe(tmp,tmp+size);
538 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
540 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
541 da2->checkAllocated();
542 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
546 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
548 std::vector<int> tmp;
549 convertPyToNewIntArr3(li,tmp);
550 DataArray *ret=self->keepSelectedComponents(tmp);
551 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
554 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
556 if(!PySlice_Check(slic))
557 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
558 Py_ssize_t strt=2,stp=2,step=2;
559 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
560 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
562 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
563 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
566 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
568 if(!PySlice_Check(slic))
569 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
570 Py_ssize_t strt=2,stp=2,step=2;
571 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
572 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
574 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
575 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
578 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
580 if(!PySlice_Check(slic))
581 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
582 Py_ssize_t strt=2,stp=2,step=2;
583 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
584 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
585 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
588 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
590 if(!PySlice_Check(slic))
591 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
592 Py_ssize_t strt=2,stp=2,step=2;
593 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
594 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
595 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
598 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
600 std::vector<const DataArray *> tmp;
601 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
602 return DataArray::Aggregate(tmp);
605 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
607 if(!PySlice_Check(slic))
608 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
609 Py_ssize_t strt=2,stp=2,step=2;
610 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
611 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
612 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
615 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
617 if(!PySlice_Check(slic))
618 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
619 Py_ssize_t strt=2,stp=2,step=2;
620 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
621 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
622 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
625 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
627 PyObject *ret(PyTuple_New(2));
628 std::string a0(self->getName());
629 const std::vector<std::string> &a1(self->getInfoOnComponents());
630 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
633 PyObject *ret1(PyList_New(sz));
634 for(int i=0;i<sz;i++)
635 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
636 PyTuple_SetItem(ret,1,ret1);
641 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
643 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 !";
644 if(!PyTuple_Check(inp))
645 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
646 int sz(PyTuple_Size(inp));
648 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
649 PyObject *a0(PyTuple_GetItem(inp,0));
650 if(!PyString_Check(a0))
651 throw INTERP_KERNEL::Exception(MSG);
652 PyObject *a1(PyTuple_GetItem(inp,1));
653 std::vector<std::string> a1cpp;
654 if(!fillStringVector(a1,a1cpp))
655 throw INTERP_KERNEL::Exception(MSG);
656 self->setName(PyString_AsString(a0));
657 self->setInfoOnComponents(a1cpp);
662 class DataArrayFloat : public DataArray
665 static DataArrayFloat *New();
666 void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
667 bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
668 bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
669 bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
670 void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
671 void iota(float init=0.) throw(INTERP_KERNEL::Exception);
674 DataArrayFloat() throw(INTERP_KERNEL::Exception)
676 return DataArrayFloat::New();
679 static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
681 return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
684 DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
686 return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
689 std::string __repr__() const throw(INTERP_KERNEL::Exception)
691 std::ostringstream oss;
692 self->reprQuickOverview(oss);
696 std::string __str__() const throw(INTERP_KERNEL::Exception)
698 return self->reprNotTooLong();
701 int __len__() const throw(INTERP_KERNEL::Exception)
703 if(self->isAllocated())
705 return self->getNumberOfTuples();
709 throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
713 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
715 const float *vals(self->begin());
716 return convertDblArrToPyList<float>(vals,self->getNbOfElems());
719 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
721 const float *vals(self->begin());
722 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
723 return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
726 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
728 return DataArrayT__getitem<float>(self,obj);
731 DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
733 return DataArrayT__setitem__<float>(self,obj,value);
737 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
739 return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
747 class DataArrayDoubleIterator;
749 class DataArrayDouble : public DataArray
752 static DataArrayDouble *New();
753 double doubleValue() const throw(INTERP_KERNEL::Exception);
754 bool empty() const throw(INTERP_KERNEL::Exception);
755 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
756 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
757 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
758 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
759 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
760 double popBackSilent() throw(INTERP_KERNEL::Exception);
761 void pack() const throw(INTERP_KERNEL::Exception);
762 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
763 void fillWithZero() throw(INTERP_KERNEL::Exception);
764 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
765 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
766 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
767 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
768 void reverse() throw(INTERP_KERNEL::Exception);
769 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
770 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
771 std::string repr() const throw(INTERP_KERNEL::Exception);
772 std::string reprZip() const throw(INTERP_KERNEL::Exception);
773 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
774 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
775 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
776 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
777 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
778 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
779 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
780 void transpose() throw(INTERP_KERNEL::Exception);
781 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
782 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
783 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
784 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
785 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
786 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
787 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
788 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
789 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
790 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
791 double front() const throw(INTERP_KERNEL::Exception);
792 double back() const throw(INTERP_KERNEL::Exception);
793 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
794 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
795 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
796 double *getPointer() throw(INTERP_KERNEL::Exception);
797 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
798 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
799 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
800 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
801 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
802 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
803 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
804 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
805 double getAverageValue() const throw(INTERP_KERNEL::Exception);
806 double norm2() const throw(INTERP_KERNEL::Exception);
807 double normMax() const throw(INTERP_KERNEL::Exception);
808 double normMin() const throw(INTERP_KERNEL::Exception);
809 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
810 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
811 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
812 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
813 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
814 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
815 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
816 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
817 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
818 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
819 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
820 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
821 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
822 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
823 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
824 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
825 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
826 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
827 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
828 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
829 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
830 void abs() throw(INTERP_KERNEL::Exception);
831 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
832 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
833 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
834 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
835 void applyPow(double val) throw(INTERP_KERNEL::Exception);
836 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
837 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
838 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
839 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
840 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
841 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
842 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
843 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
844 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
845 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
846 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
847 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
848 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
849 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
850 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
851 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
852 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
853 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
854 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
855 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
856 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
857 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
858 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
859 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
860 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
861 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
862 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
863 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
866 DataArrayDouble() throw(INTERP_KERNEL::Exception)
868 return DataArrayDouble::New();
871 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
873 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
876 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
878 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
881 DataArrayDouble *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
883 MCAuto<DataArrayDouble> ret(self->selectPartDef(pd));
887 DataArrayDouble *cumSum() const throw(INTERP_KERNEL::Exception)
889 MCAuto<DataArrayDouble> ret(self->cumSum());
893 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
896 std::vector<double> bb;
898 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
899 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
900 self->pushBackValsSilent(tmp,tmp+nbTuples);
903 std::string __repr__() const throw(INTERP_KERNEL::Exception)
905 std::ostringstream oss;
906 self->reprQuickOverview(oss);
910 std::string __str__() const throw(INTERP_KERNEL::Exception)
912 return self->reprNotTooLong();
915 double __float__() const throw(INTERP_KERNEL::Exception)
917 return self->doubleValue();
920 int __len__() const throw(INTERP_KERNEL::Exception)
922 if(self->isAllocated())
924 return self->getNumberOfTuples();
928 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
932 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
934 return self->iterator();
937 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
939 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 !";
940 if(PyList_Check(li) || PyTuple_Check(li))
944 if(PyInt_Check(nbOfTuples))
946 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
948 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
951 if(PyInt_Check(nbOfComp))
952 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
953 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
955 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
956 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
957 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
960 throw INTERP_KERNEL::Exception(msg);
963 {//DataArrayDouble.setValues([1.,3.,4.],3)
965 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
966 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
970 throw INTERP_KERNEL::Exception(msg);
973 {// DataArrayDouble.setValues([1.,3.,4.])
974 int tmpp1=-1,tmpp2=-1;
975 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
976 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
980 throw INTERP_KERNEL::Exception(msg);
983 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
985 const double *vals(self->begin());
986 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
990 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
992 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
996 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
999 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1000 PyObject *ret=PyTuple_New(2);
1001 PyObject *ret0Py=ret0?Py_True:Py_False;
1003 PyTuple_SetItem(ret,0,ret0Py);
1004 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1008 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1010 const double *vals(self->begin());
1011 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1012 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1015 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1017 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1019 DataArrayDouble *a,*a2;
1020 DataArrayDoubleTuple *aa,*aa2;
1021 std::vector<double> bb,bb2;
1023 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1024 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1025 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1029 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1031 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1033 DataArrayDouble *a,*a2;
1034 DataArrayDoubleTuple *aa,*aa2;
1035 std::vector<double> bb,bb2;
1037 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1039 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1040 return convertDblArrToPyListOfTuple<double>(res,3,3);
1043 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1045 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1047 DataArrayDouble *a,*a2;
1048 DataArrayDoubleTuple *aa,*aa2;
1049 std::vector<double> bb,bb2;
1051 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1052 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1053 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1056 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1059 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1060 if (!SWIG_IsOK(res1))
1063 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1064 if(size!=self->getNumberOfTuples())
1066 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1068 return self->renumber(tmp);
1072 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1074 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1075 da2->checkAllocated();
1076 int size=self->getNumberOfTuples();
1077 if(size!=self->getNumberOfTuples())
1079 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1081 return self->renumber(da2->getConstPointer());
1085 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1088 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1089 if (!SWIG_IsOK(res1))
1092 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1093 if(size!=self->getNumberOfTuples())
1095 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1097 return self->renumberR(tmp);
1101 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1103 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1104 da2->checkAllocated();
1105 int size=self->getNumberOfTuples();
1106 if(size!=self->getNumberOfTuples())
1108 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1110 return self->renumberR(da2->getConstPointer());
1114 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1117 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1118 if (!SWIG_IsOK(res1))
1121 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1122 if(size!=self->getNumberOfTuples())
1124 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1126 return self->renumberAndReduce(tmp,newNbOfTuple);
1130 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1132 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1133 da2->checkAllocated();
1134 int size=self->getNumberOfTuples();
1135 if(size!=self->getNumberOfTuples())
1137 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1139 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1143 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1145 int thisTupleId,otherTupleId;
1146 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1147 PyObject *ret=PyTuple_New(3);
1148 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1149 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1150 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1154 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1157 double r1=self->getMaxValue(tmp);
1158 PyObject *ret=PyTuple_New(2);
1159 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1160 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1164 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1167 double r1=self->getMaxValue2(tmp);
1168 PyObject *ret=PyTuple_New(2);
1169 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1170 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1174 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1177 double r1=self->getMinValue(tmp);
1178 PyObject *ret=PyTuple_New(2);
1179 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1180 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1184 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1187 double r1=self->getMinValue2(tmp);
1188 PyObject *ret=PyTuple_New(2);
1189 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1190 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1194 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1196 int nbOfCompo(self->getNumberOfComponents());
1197 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1198 self->getMinMaxPerComponent(tmp);
1199 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1203 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1205 int sz=self->getNumberOfComponents();
1206 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1207 self->accumulate(tmp);
1208 return convertDblArrToPyList<double>(tmp,sz);
1211 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1214 std::vector<int> val2;
1215 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1216 return self->accumulatePerChunck(bg,bg+sz);
1219 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1221 DataArrayInt *comm, *commIndex;
1222 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1223 PyObject *res = PyList_New(2);
1224 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1225 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1229 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1233 DataArrayDoubleTuple *aa;
1234 std::vector<double> bb;
1236 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1237 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1239 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1240 PyObject *ret=PyTuple_New(2);
1241 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1242 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1246 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1248 std::vector<int> tmp;
1249 convertPyToNewIntArr3(li,tmp);
1250 self->setSelectedComponents(a,tmp);
1253 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1255 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1256 std::size_t sz(retCpp.size());
1257 PyObject *res(PyList_New(sz));
1258 for(std::size_t i=0;i<sz;i++)
1259 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1263 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1265 int sz=self->getNumberOfComponents();
1266 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1267 self->getTuple(tupleId,tmp);
1268 return convertDblArrToPyList<double>(tmp,sz);
1271 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1273 std::vector<const DataArrayDouble *> tmp;
1274 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1275 return DataArrayDouble::Aggregate(tmp);
1278 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1280 std::vector<const DataArrayDouble *> tmp;
1281 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1282 return DataArrayDouble::Meld(tmp);
1285 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1289 DataArrayDoubleTuple *aa;
1290 std::vector<double> bb;
1292 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1293 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1294 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1295 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1296 DataArrayInt *c=0,*cI=0;
1297 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1298 PyObject *ret=PyTuple_New(2);
1299 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1300 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1304 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1306 DataArrayInt *ret1=0;
1307 bool ret0=self->areIncludedInMe(other,prec,ret1);
1308 PyObject *ret=PyTuple_New(2);
1309 PyObject *ret0Py=ret0?Py_True:Py_False;
1311 PyTuple_SetItem(ret,0,ret0Py);
1312 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1316 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1318 return DataArrayT__getitem<double>(self,obj);
1321 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1323 return DataArrayT__setitem__<double>(self,obj,value);
1326 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1328 return self->negate();
1331 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1333 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1336 DataArrayDoubleTuple *aa;
1337 std::vector<double> bb;
1340 #ifndef WITHOUT_AUTOFIELD
1342 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1344 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1347 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1348 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1350 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1353 throw INTERP_KERNEL::Exception(msg);
1357 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1362 MCAuto<DataArrayDouble> ret=self->deepCopy();
1363 ret->applyLin(1.,val);
1364 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1368 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1372 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1373 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1377 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1378 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1381 throw INTERP_KERNEL::Exception(msg);
1385 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1387 const char msg[]="Unexpected situation in __radd__ !";
1390 DataArrayDoubleTuple *aa;
1391 std::vector<double> bb;
1393 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1398 MCAuto<DataArrayDouble> ret=self->deepCopy();
1399 ret->applyLin(1.,val);
1404 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1405 return DataArrayDouble::Add(self,aaa);
1409 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1410 return DataArrayDouble::Add(self,aaa);
1413 throw INTERP_KERNEL::Exception(msg);
1417 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1419 const char msg[]="Unexpected situation in __iadd__ !";
1422 DataArrayDoubleTuple *aa;
1423 std::vector<double> bb;
1425 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1430 self->applyLin(1.,val);
1431 Py_XINCREF(trueSelf);
1437 Py_XINCREF(trueSelf);
1442 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1443 self->addEqual(aaa);
1444 Py_XINCREF(trueSelf);
1449 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1450 self->addEqual(aaa);
1451 Py_XINCREF(trueSelf);
1455 throw INTERP_KERNEL::Exception(msg);
1459 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1461 const char msg[]="Unexpected situation in __sub__ !";
1464 DataArrayDoubleTuple *aa;
1465 std::vector<double> bb;
1468 #ifndef WITHOUT_AUTOFIELD
1470 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1472 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1475 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1476 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1478 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1481 throw INTERP_KERNEL::Exception(msg);
1485 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1490 MCAuto<DataArrayDouble> ret=self->deepCopy();
1491 ret->applyLin(1.,-val);
1492 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1496 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1500 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1501 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1505 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1506 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1509 throw INTERP_KERNEL::Exception(msg);
1513 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1515 const char msg[]="Unexpected situation in __rsub__ !";
1518 DataArrayDoubleTuple *aa;
1519 std::vector<double> bb;
1521 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1526 MCAuto<DataArrayDouble> ret=self->deepCopy();
1527 ret->applyLin(-1.,val);
1532 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1533 return DataArrayDouble::Substract(aaa,self);
1537 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1538 return DataArrayDouble::Substract(aaa,self);
1541 throw INTERP_KERNEL::Exception(msg);
1545 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1547 const char msg[]="Unexpected situation in __isub__ !";
1550 DataArrayDoubleTuple *aa;
1551 std::vector<double> bb;
1553 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1558 self->applyLin(1,-val);
1559 Py_XINCREF(trueSelf);
1564 self->substractEqual(a);
1565 Py_XINCREF(trueSelf);
1570 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1571 self->substractEqual(aaa);
1572 Py_XINCREF(trueSelf);
1577 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1578 self->substractEqual(aaa);
1579 Py_XINCREF(trueSelf);
1583 throw INTERP_KERNEL::Exception(msg);
1587 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1589 const char msg[]="Unexpected situation in __mul__ !";
1592 DataArrayDoubleTuple *aa;
1593 std::vector<double> bb;
1596 #ifndef WITHOUT_AUTOFIELD
1598 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1600 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1603 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1604 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1606 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1609 throw INTERP_KERNEL::Exception(msg);
1613 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1618 MCAuto<DataArrayDouble> ret=self->deepCopy();
1619 ret->applyLin(val,0.);
1620 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1624 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1628 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1629 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1633 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1634 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1637 throw INTERP_KERNEL::Exception(msg);
1641 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1643 const char msg[]="Unexpected situation in __rmul__ !";
1646 DataArrayDoubleTuple *aa;
1647 std::vector<double> bb;
1649 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1654 MCAuto<DataArrayDouble> ret=self->deepCopy();
1655 ret->applyLin(val,0.);
1660 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1661 return DataArrayDouble::Multiply(self,aaa);
1665 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1666 return DataArrayDouble::Multiply(self,aaa);
1669 throw INTERP_KERNEL::Exception(msg);
1673 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1675 const char msg[]="Unexpected situation in __imul__ !";
1678 DataArrayDoubleTuple *aa;
1679 std::vector<double> bb;
1681 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1686 self->applyLin(val,0.);
1687 Py_XINCREF(trueSelf);
1692 self->multiplyEqual(a);
1693 Py_XINCREF(trueSelf);
1698 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1699 self->multiplyEqual(aaa);
1700 Py_XINCREF(trueSelf);
1705 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1706 self->multiplyEqual(aaa);
1707 Py_XINCREF(trueSelf);
1711 throw INTERP_KERNEL::Exception(msg);
1715 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1717 const char msg[]="Unexpected situation in __div__ !";
1720 DataArrayDoubleTuple *aa;
1721 std::vector<double> bb;
1724 #ifndef WITHOUT_AUTOFIELD
1726 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1728 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1731 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1732 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1734 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1737 throw INTERP_KERNEL::Exception(msg);
1741 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1747 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1748 MCAuto<DataArrayDouble> ret=self->deepCopy();
1749 ret->applyLin(1/val,0.);
1750 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1754 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1758 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1759 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1763 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1764 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1767 throw INTERP_KERNEL::Exception(msg);
1771 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1773 const char msg[]="Unexpected situation in __rdiv__ !";
1776 DataArrayDoubleTuple *aa;
1777 std::vector<double> bb;
1779 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1784 MCAuto<DataArrayDouble> ret=self->deepCopy();
1790 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1791 return DataArrayDouble::Divide(aaa,self);
1795 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1796 return DataArrayDouble::Divide(aaa,self);
1799 throw INTERP_KERNEL::Exception(msg);
1803 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1805 const char msg[]="Unexpected situation in __idiv__ !";
1808 DataArrayDoubleTuple *aa;
1809 std::vector<double> bb;
1811 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1817 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1818 self->applyLin(1./val,0.);
1819 Py_XINCREF(trueSelf);
1824 self->divideEqual(a);
1825 Py_XINCREF(trueSelf);
1830 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1831 self->divideEqual(aaa);
1832 Py_XINCREF(trueSelf);
1837 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1838 self->divideEqual(aaa);
1839 Py_XINCREF(trueSelf);
1843 throw INTERP_KERNEL::Exception(msg);
1847 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1849 const char msg[]="Unexpected situation in __pow__ !";
1852 DataArrayDoubleTuple *aa;
1853 std::vector<double> bb;
1855 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1860 MCAuto<DataArrayDouble> ret=self->deepCopy();
1866 return DataArrayDouble::Pow(self,a);
1870 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1871 return DataArrayDouble::Pow(self,aaa);
1875 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1876 return DataArrayDouble::Pow(self,aaa);
1879 throw INTERP_KERNEL::Exception(msg);
1883 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1885 const char msg[]="Unexpected situation in __rpow__ !";
1888 DataArrayDoubleTuple *aa;
1889 std::vector<double> bb;
1891 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1896 MCAuto<DataArrayDouble> ret=self->deepCopy();
1897 ret->applyRPow(val);
1902 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1903 return DataArrayDouble::Pow(aaa,self);
1907 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1908 return DataArrayDouble::Pow(aaa,self);
1911 throw INTERP_KERNEL::Exception(msg);
1915 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1917 const char msg[]="Unexpected situation in __ipow__ !";
1920 DataArrayDoubleTuple *aa;
1921 std::vector<double> bb;
1923 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1928 self->applyPow(val);
1929 Py_XINCREF(trueSelf);
1935 Py_XINCREF(trueSelf);
1940 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1941 self->powEqual(aaa);
1942 Py_XINCREF(trueSelf);
1947 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1948 self->powEqual(aaa);
1949 Py_XINCREF(trueSelf);
1953 throw INTERP_KERNEL::Exception(msg);
1957 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1959 DataArrayInt *c=0,*cI=0;
1961 self->computeTupleIdsNearTuples(other,eps,c,cI);
1962 PyObject *ret=PyTuple_New(2);
1963 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1964 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1968 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1970 DataArrayInt *ret1=0;
1971 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1972 PyObject *ret=PyTuple_New(2);
1973 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1974 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1979 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
1981 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
1984 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
1987 if(!self->isAllocated())
1988 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
1989 PyObject *ret(PyTuple_New(1));
1990 PyObject *ret0(PyDict_New());
1991 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
1992 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
1993 PyObject *tmp1(PyInt_FromLong(0));
1994 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
1995 PyTuple_SetItem(ret,0,ret0);
1999 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2005 class DataArrayDoubleTuple;
2007 class DataArrayDoubleIterator
2010 DataArrayDoubleIterator(DataArrayDouble *da);
2011 ~DataArrayDoubleIterator();
2016 DataArrayDoubleTuple *ret=self->nextt();
2018 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2021 PyErr_SetString(PyExc_StopIteration,"No more data.");
2028 class DataArrayDoubleTuple
2031 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2032 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2035 std::string __str__() const throw(INTERP_KERNEL::Exception)
2037 return self->repr();
2040 double __float__() const throw(INTERP_KERNEL::Exception)
2042 return self->doubleValue();
2045 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2047 return self->buildDADouble(1,self->getNumberOfCompo());
2050 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2052 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2053 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2054 Py_XINCREF(trueSelf);
2058 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2060 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2061 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2062 Py_XINCREF(trueSelf);
2066 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2068 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2069 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2070 Py_XINCREF(trueSelf);
2074 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2076 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2077 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2078 Py_XINCREF(trueSelf);
2082 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2084 return PyInt_FromLong(self->getNumberOfCompo());
2087 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2089 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2092 std::vector<int> multiVal;
2093 std::pair<int, std::pair<int,int> > slic;
2094 MEDCoupling::DataArrayInt *daIntTyypp=0;
2095 const double *pt=self->getConstPointer();
2096 int nbc=self->getNumberOfCompo();
2097 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2104 std::ostringstream oss;
2105 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2106 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2110 return PyFloat_FromDouble(pt[singleVal]);
2114 return PyFloat_FromDouble(pt[nbc+singleVal]);
2117 std::ostringstream oss;
2118 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2119 throw INTERP_KERNEL::Exception(oss.str().c_str());
2125 PyObject *t=PyTuple_New(multiVal.size());
2126 for(int j=0;j<(int)multiVal.size();j++)
2128 int cid=multiVal[j];
2131 std::ostringstream oss;
2132 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2133 throw INTERP_KERNEL::Exception(oss.str().c_str());
2135 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2141 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2142 PyObject *t=PyTuple_New(sz);
2143 for(int j=0;j<sz;j++)
2144 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2148 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2152 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2154 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2155 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2158 std::vector<double> multiValV;
2159 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2160 int nbc=self->getNumberOfCompo();
2161 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2163 std::vector<int> multiVal;
2164 std::pair<int, std::pair<int,int> > slic;
2165 MEDCoupling::DataArrayInt *daIntTyypp=0;
2166 double *pt=self->getPointer();
2167 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2174 std::ostringstream oss;
2175 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2176 throw INTERP_KERNEL::Exception(oss.str().c_str());
2182 pt[singleVal]=singleValV;
2187 if(multiValV.size()!=1)
2189 std::ostringstream oss;
2190 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2191 throw INTERP_KERNEL::Exception(oss.str().c_str());
2193 pt[singleVal]=multiValV[0];
2198 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2202 throw INTERP_KERNEL::Exception(msg);
2211 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2215 std::ostringstream oss;
2216 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2217 throw INTERP_KERNEL::Exception(oss.str().c_str());
2225 if(multiVal.size()!=multiValV.size())
2227 std::ostringstream oss;
2228 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2229 throw INTERP_KERNEL::Exception(oss.str().c_str());
2231 for(int i=0;i<(int)multiVal.size();i++)
2233 int pos=multiVal[i];
2236 std::ostringstream oss;
2237 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2238 throw INTERP_KERNEL::Exception(oss.str().c_str());
2240 pt[multiVal[i]]=multiValV[i];
2246 const double *ptV=daIntTyyppV->getConstPointer();
2247 if(nbc>daIntTyyppV->getNumberOfCompo())
2249 std::ostringstream oss;
2250 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2251 throw INTERP_KERNEL::Exception(oss.str().c_str());
2253 std::copy(ptV,ptV+nbc,pt);
2257 throw INTERP_KERNEL::Exception(msg);
2262 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2267 for(int j=0;j<sz;j++)
2268 pt[slic.first+j*slic.second.second]=singleValV;
2273 if(sz!=(int)multiValV.size())
2275 std::ostringstream oss;
2276 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2277 throw INTERP_KERNEL::Exception(oss.str().c_str());
2279 for(int j=0;j<sz;j++)
2280 pt[slic.first+j*slic.second.second]=multiValV[j];
2285 const double *ptV=daIntTyyppV->getConstPointer();
2286 if(sz>daIntTyyppV->getNumberOfCompo())
2288 std::ostringstream oss;
2289 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2290 throw INTERP_KERNEL::Exception(oss.str().c_str());
2292 for(int j=0;j<sz;j++)
2293 pt[slic.first+j*slic.second.second]=ptV[j];
2297 throw INTERP_KERNEL::Exception(msg);
2301 throw INTERP_KERNEL::Exception(msg);
2307 class DataArrayIntIterator;
2309 class DataArrayInt : public DataArray
2312 static DataArrayInt *New();
2313 int intValue() const throw(INTERP_KERNEL::Exception);
2314 int getHashCode() const throw(INTERP_KERNEL::Exception);
2315 bool empty() const throw(INTERP_KERNEL::Exception);
2316 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2317 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2318 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2319 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2320 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2321 int popBackSilent() throw(INTERP_KERNEL::Exception);
2322 void pack() const throw(INTERP_KERNEL::Exception);
2323 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2324 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2325 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2326 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2327 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2328 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2329 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2330 void reverse() throw(INTERP_KERNEL::Exception);
2331 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2332 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2333 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2334 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2335 void fillWithZero() throw(INTERP_KERNEL::Exception);
2336 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2337 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2338 std::string repr() const throw(INTERP_KERNEL::Exception);
2339 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2340 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2341 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2342 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2343 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2344 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2345 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2346 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2347 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2348 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2349 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2350 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2351 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2352 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2353 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2354 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2355 void transpose() throw(INTERP_KERNEL::Exception);
2356 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2357 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2358 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2359 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2360 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2361 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2362 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2363 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2364 int front() const throw(INTERP_KERNEL::Exception);
2365 int back() const throw(INTERP_KERNEL::Exception);
2366 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2367 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2368 int *getPointer() throw(INTERP_KERNEL::Exception);
2369 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2370 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2371 const int *begin() const throw(INTERP_KERNEL::Exception);
2372 const int *end() const throw(INTERP_KERNEL::Exception);
2373 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2374 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2375 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2376 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2377 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2378 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2379 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2380 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2381 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2382 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2383 int count(int value) const throw(INTERP_KERNEL::Exception);
2384 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2385 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2386 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2387 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2388 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2389 void abs() throw(INTERP_KERNEL::Exception);
2390 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2391 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2392 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2393 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2394 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2395 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2396 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2397 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2398 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2399 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2400 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2401 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2402 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2403 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2404 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2405 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2406 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2407 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2408 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2409 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2410 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2411 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2412 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2413 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2414 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2415 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2416 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2417 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2418 void computeOffsets() throw(INTERP_KERNEL::Exception);
2419 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2420 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2421 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2422 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2423 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2424 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2425 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2426 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2427 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2428 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2429 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2430 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2431 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2432 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2433 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2434 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2435 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2436 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2437 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2439 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2442 DataArrayInt() throw(INTERP_KERNEL::Exception)
2444 return DataArrayInt::New();
2447 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2449 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)";
2450 std::string msg(msgBase);
2452 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2455 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2459 if(PyInt_Check(nbOfTuples))
2461 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2463 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2466 if(PyInt_Check(nbOfComp))
2467 {//DataArrayInt.New([1,3,4,5],2,2)
2468 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2470 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2471 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2472 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2473 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2477 throw INTERP_KERNEL::Exception(msg.c_str());
2480 {//DataArrayInt.New([1,3,4],3)
2481 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2483 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2484 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2489 throw INTERP_KERNEL::Exception(msg.c_str());
2492 {// DataArrayInt.New([1,3,4])
2493 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2494 int tmpp1=-1,tmpp2=-1;
2495 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2496 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2500 else if(PyInt_Check(elt0))
2502 int nbOfTuples1=PyInt_AS_LONG(elt0);
2504 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2509 if(PyInt_Check(nbOfTuples))
2510 {//DataArrayInt.New(5,2)
2511 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2513 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2514 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2515 ret->alloc(nbOfTuples1,nbOfCompo);
2519 throw INTERP_KERNEL::Exception(msg.c_str());
2522 throw INTERP_KERNEL::Exception(msg.c_str());
2525 {//DataArrayInt.New(5)
2526 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2527 ret->alloc(nbOfTuples1,1);
2532 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2533 {//DataArrayInt.New(numpyArray)
2534 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2538 throw INTERP_KERNEL::Exception(msg.c_str());
2539 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2542 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2544 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2547 std::string __str__() const throw(INTERP_KERNEL::Exception)
2549 return self->reprNotTooLong();
2552 int __len__() const throw(INTERP_KERNEL::Exception)
2554 if(self->isAllocated())
2556 return self->getNumberOfTuples();
2560 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2564 int __int__() const throw(INTERP_KERNEL::Exception)
2566 return self->intValue();
2569 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2571 return self->iterator();
2574 DataArrayInt *fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception)
2576 MCAuto<DataArrayInt> ret(self->fromLinkedListOfPairToList());
2580 DataArrayInt *findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
2582 MCAuto<DataArrayInt> ret(self->findIdsGreaterOrEqualTo(val));
2586 DataArrayInt *findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception)
2588 MCAuto<DataArrayInt> ret(self->findIdsGreaterThan(val));
2592 DataArrayInt *findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
2594 MCAuto<DataArrayInt> ret(self->findIdsLowerOrEqualTo(val));
2598 DataArrayInt *findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception)
2600 MCAuto<DataArrayInt> ret(self->findIdsLowerThan(val));
2604 DataArrayInt *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
2606 MCAuto<DataArrayInt> ret(self->selectPartDef(pd));
2610 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2612 int sz=self->getNumberOfComponents();
2613 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2614 self->accumulate(tmp);
2615 return convertIntArrToPyList(tmp,sz);
2618 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2621 std::vector<int> val2;
2622 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2623 return self->accumulatePerChunck(bg,bg+sz);
2626 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2629 std::vector<int> val2;
2630 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2631 return self->findIdsEqualTuple(bg,bg+sz);
2634 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2636 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2637 PyObject *ret=PyList_New(slcs.size());
2638 for(std::size_t i=0;i<slcs.size();i++)
2639 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2643 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2645 if(!PySlice_Check(slic))
2646 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2647 Py_ssize_t strt=2,stp=2,step=2;
2648 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2649 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2650 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2651 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 !");
2652 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2655 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2658 self->getMinMaxValues(a,b);
2659 PyObject *ret=PyTuple_New(2);
2660 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2661 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2665 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2667 int newNbOfTuples=-1;
2668 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2669 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2670 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2671 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2672 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2673 PyObject *ret=PyTuple_New(2);
2674 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2675 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2679 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2681 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2682 int szArr,sw,iTypppArr;
2683 std::vector<int> stdvecTyyppArr;
2684 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2685 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2686 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2690 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2692 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 !";
2693 if(PyList_Check(li) || PyTuple_Check(li))
2695 if(nbOfTuples && nbOfTuples != Py_None)
2697 if(PyInt_Check(nbOfTuples))
2699 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2701 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2702 if(nbOfComp && nbOfComp != Py_None)
2704 if(PyInt_Check(nbOfComp))
2705 {//DataArrayInt.setValues([1,3,4,5],2,2)
2706 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2708 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2709 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2710 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2713 throw INTERP_KERNEL::Exception(msg);
2716 {//DataArrayInt.setValues([1,3,4],3)
2718 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2719 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2723 throw INTERP_KERNEL::Exception(msg);
2726 {// DataArrayInt.setValues([1,3,4])
2727 int tmpp1=-1,tmpp2=-1;
2728 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2729 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2733 throw INTERP_KERNEL::Exception(msg);
2736 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2738 const int *vals=self->getConstPointer();
2739 return convertIntArrToPyList(vals,self->getNbOfElems());
2743 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2745 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2749 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2752 bool ret0=self->isEqualIfNotWhy(other,ret1);
2753 PyObject *ret=PyTuple_New(2);
2754 PyObject *ret0Py=ret0?Py_True:Py_False;
2756 PyTuple_SetItem(ret,0,ret0Py);
2757 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2761 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2763 const int *vals=self->getConstPointer();
2764 int nbOfComp=self->getNumberOfComponents();
2765 int nbOfTuples=self->getNumberOfTuples();
2766 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2769 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2771 std::vector<const DataArrayInt *> groups;
2772 std::vector< std::vector<int> > fidsOfGroups;
2773 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2774 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2775 PyObject *ret = PyList_New(2);
2776 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2777 int sz=fidsOfGroups.size();
2778 PyObject *ret1 = PyList_New(sz);
2779 for(int i=0;i<sz;i++)
2780 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2781 PyList_SetItem(ret,1,ret1);
2785 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2788 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2789 if (!SWIG_IsOK(res1))
2792 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2793 self->transformWithIndArr(tmp,tmp+size);
2797 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2798 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2802 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2806 std::vector<int> multiVal;
2807 std::pair<int, std::pair<int,int> > slic;
2808 MEDCoupling::DataArrayInt *daIntTyypp=0;
2809 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2813 return self->findIdsEqualList(&singleVal,&singleVal+1);
2815 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2817 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2819 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2823 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2827 std::vector<int> multiVal;
2828 std::pair<int, std::pair<int,int> > slic;
2829 MEDCoupling::DataArrayInt *daIntTyypp=0;
2830 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2834 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2836 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2838 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2840 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2844 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2846 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2848 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2849 if (!SWIG_IsOK(res1))
2852 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2853 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2857 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2859 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2860 da2->checkAllocated();
2861 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2863 PyObject *ret = PyList_New(3);
2864 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2865 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2866 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2870 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2873 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2874 if (!SWIG_IsOK(res1))
2877 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2878 return self->transformWithIndArrR(tmp,tmp+size);
2882 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2883 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2887 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2890 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2891 if (!SWIG_IsOK(res1))
2894 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2895 if(size!=self->getNumberOfTuples())
2897 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2899 return self->renumberAndReduce(tmp,newNbOfTuple);
2903 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2905 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2906 da2->checkAllocated();
2907 int size=self->getNumberOfTuples();
2908 if(size!=self->getNumberOfTuples())
2910 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2912 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2916 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2919 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2920 if (!SWIG_IsOK(res1))
2923 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2924 if(size!=self->getNumberOfTuples())
2926 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2928 return self->renumber(tmp);
2932 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2934 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2935 da2->checkAllocated();
2936 int size=self->getNumberOfTuples();
2937 if(size!=self->getNumberOfTuples())
2939 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2941 return self->renumber(da2->getConstPointer());
2945 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2948 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2949 if (!SWIG_IsOK(res1))
2952 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2953 if(size!=self->getNumberOfTuples())
2955 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2957 return self->renumberR(tmp);
2961 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2963 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2964 da2->checkAllocated();
2965 int size=self->getNumberOfTuples();
2966 if(size!=self->getNumberOfTuples())
2968 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2970 return self->renumberR(da2->getConstPointer());
2974 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2976 std::vector<int> tmp;
2977 convertPyToNewIntArr3(li,tmp);
2978 self->setSelectedComponents(a,tmp);
2981 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2983 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2984 std::size_t sz(retCpp.size());
2985 PyObject *res(PyList_New(sz));
2986 for(std::size_t i=0;i<sz;i++)
2987 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2991 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2993 int sz=self->getNumberOfComponents();
2994 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2995 self->getTuple(tupleId,tmp);
2996 return convertIntArrToPyList(tmp,sz);
2999 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3001 DataArrayInt *arr=0;
3002 DataArrayInt *arrI=0;
3003 self->changeSurjectiveFormat(targetNb,arr,arrI);
3004 PyObject *res = PyList_New(2);
3005 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3006 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3010 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3012 std::vector<const DataArrayInt *> tmp;
3013 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3014 return DataArrayInt::Meld(tmp);
3017 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3019 std::vector<const DataArrayInt *> tmp;
3020 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3021 return DataArrayInt::Aggregate(tmp);
3024 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3026 std::vector<const DataArrayInt *> tmp;
3027 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3028 return DataArrayInt::AggregateIndexes(tmp);
3031 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3033 std::vector<const DataArrayInt *> tmp;
3034 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3035 return DataArrayInt::BuildUnion(tmp);
3038 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3040 std::vector<const DataArrayInt *> tmp;
3041 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3042 return DataArrayInt::BuildIntersection(tmp);
3045 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3048 int r1=self->getMaxValue(tmp);
3049 PyObject *ret=PyTuple_New(2);
3050 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3051 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3055 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3058 int r1=self->getMinValue(tmp);
3059 PyObject *ret=PyTuple_New(2);
3060 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3061 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3065 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3067 int nbOfCompo=self->getNumberOfComponents();
3072 if(PyInt_Check(obj))
3074 int val=(int)PyInt_AS_LONG(obj);
3075 return self->findIdFirstEqual(val);
3078 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3082 std::vector<int> arr;
3083 convertPyToNewIntArr3(obj,arr);
3084 return self->findIdFirstEqualTuple(arr);
3089 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3091 int nbOfCompo=self->getNumberOfComponents();
3098 if(PyInt_Check(obj))
3100 int val=(int)PyInt_AS_LONG(obj);
3101 return self->presenceOfValue(val);
3104 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3108 std::vector<int> arr;
3109 convertPyToNewIntArr3(obj,arr);
3110 return self->presenceOfTuple(arr);
3115 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3117 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3118 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3119 self->checkAllocated();
3120 int nbOfTuples=self->getNumberOfTuples();
3121 int nbOfComponents=self->getNumberOfComponents();
3123 std::vector<int> vt1,vc1;
3124 std::pair<int, std::pair<int,int> > pt1,pc1;
3125 DataArrayInt *dt1=0,*dc1=0;
3127 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3128 MCAuto<DataArrayInt> ret;
3133 if(nbOfComponents==1)
3134 return PyInt_FromLong(self->getIJSafe(it1,0));
3135 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3138 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3140 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3142 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3144 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3147 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3148 std::vector<int> v2(1,ic1);
3149 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3153 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3154 std::vector<int> v2(1,ic1);
3155 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3159 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3160 std::vector<int> v2(1,ic1);
3161 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3165 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3166 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3170 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3171 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3175 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3176 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3180 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3181 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3185 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3186 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3187 std::vector<int> v2(nbOfComp);
3188 for(int i=0;i<nbOfComp;i++)
3189 v2[i]=pc1.first+i*pc1.second.second;
3190 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3194 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3195 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3196 std::vector<int> v2(nbOfComp);
3197 for(int i=0;i<nbOfComp;i++)
3198 v2[i]=pc1.first+i*pc1.second.second;
3199 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3203 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3204 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3205 std::vector<int> v2(nbOfComp);
3206 for(int i=0;i<nbOfComp;i++)
3207 v2[i]=pc1.first+i*pc1.second.second;
3208 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3212 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3213 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3214 std::vector<int> v2(nbOfComp);
3215 for(int i=0;i<nbOfComp;i++)
3216 v2[i]=pc1.first+i*pc1.second.second;
3217 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3220 throw INTERP_KERNEL::Exception(msg);
3224 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3226 self->checkAllocated();
3227 const char msg[]="Unexpected situation in __setitem__ !";
3228 int nbOfTuples=self->getNumberOfTuples();
3229 int nbOfComponents=self->getNumberOfComponents();
3232 std::vector<int> v1;
3234 DataArrayIntTuple *dd1=0;
3235 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3237 std::vector<int> vt1,vc1;
3238 std::pair<int, std::pair<int,int> > pt1,pc1;
3239 DataArrayInt *dt1=0,*dc1=0;
3240 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3241 MCAuto<DataArrayInt> tmp;
3249 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3252 tmp=DataArrayInt::New();
3253 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3254 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3257 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3260 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3261 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3264 throw INTERP_KERNEL::Exception(msg);
3273 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3276 tmp=DataArrayInt::New();
3277 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3278 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3281 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3284 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3285 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3288 throw INTERP_KERNEL::Exception(msg);
3297 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3300 tmp=DataArrayInt::New();
3301 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3302 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3305 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3308 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3309 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3312 throw INTERP_KERNEL::Exception(msg);
3321 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3324 tmp=DataArrayInt::New();
3325 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3326 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3329 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3332 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3333 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3336 throw INTERP_KERNEL::Exception(msg);
3345 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3348 tmp=DataArrayInt::New();
3349 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3350 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3353 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3356 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3357 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3360 throw INTERP_KERNEL::Exception(msg);
3369 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3372 tmp=DataArrayInt::New();
3373 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3374 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3377 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3380 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3381 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3384 throw INTERP_KERNEL::Exception(msg);
3393 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3396 tmp=DataArrayInt::New();
3397 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3398 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3401 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3404 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3405 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3408 throw INTERP_KERNEL::Exception(msg);
3417 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3420 tmp=DataArrayInt::New();
3421 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3422 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3425 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3428 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3429 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3432 throw INTERP_KERNEL::Exception(msg);
3441 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3444 tmp=DataArrayInt::New();
3445 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3446 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3449 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3452 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3453 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3456 throw INTERP_KERNEL::Exception(msg);
3465 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3468 tmp=DataArrayInt::New();
3469 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3470 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3473 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3476 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3477 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3480 throw INTERP_KERNEL::Exception(msg);
3489 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3492 tmp=DataArrayInt::New();
3493 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3494 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3497 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3500 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3501 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3504 throw INTERP_KERNEL::Exception(msg);
3513 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3516 tmp=DataArrayInt::New();
3517 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3518 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3521 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3524 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3525 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3528 throw INTERP_KERNEL::Exception(msg);
3537 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3540 tmp=DataArrayInt::New();
3541 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3542 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3545 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3548 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3549 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3552 throw INTERP_KERNEL::Exception(msg);
3561 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3564 tmp=DataArrayInt::New();
3565 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3566 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3569 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3572 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3573 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3576 throw INTERP_KERNEL::Exception(msg);
3585 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3588 tmp=DataArrayInt::New();
3589 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3590 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3593 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3596 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3597 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3600 throw INTERP_KERNEL::Exception(msg);
3609 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3612 tmp=DataArrayInt::New();
3613 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3614 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3617 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3620 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3621 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3624 throw INTERP_KERNEL::Exception(msg);
3629 throw INTERP_KERNEL::Exception(msg);
3634 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3636 return self->negate();
3639 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3641 const char msg[]="Unexpected situation in __add__ !";
3644 std::vector<int> aa;
3645 DataArrayIntTuple *aaa;
3647 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3652 MCAuto<DataArrayInt> ret=self->deepCopy();
3653 ret->applyLin(1,val);
3658 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3659 return DataArrayInt::Add(self,aaaa);
3663 return DataArrayInt::Add(self,a);
3667 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3668 return DataArrayInt::Add(self,aaaa);
3671 throw INTERP_KERNEL::Exception(msg);
3675 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3677 const char msg[]="Unexpected situation in __radd__ !";
3680 std::vector<int> aa;
3681 DataArrayIntTuple *aaa;
3683 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3688 MCAuto<DataArrayInt> ret=self->deepCopy();
3689 ret->applyLin(1,val);
3694 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3695 return DataArrayInt::Add(self,aaaa);
3699 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3700 return DataArrayInt::Add(self,aaaa);
3703 throw INTERP_KERNEL::Exception(msg);
3707 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3709 const char msg[]="Unexpected situation in __iadd__ !";
3712 std::vector<int> aa;
3713 DataArrayIntTuple *aaa;
3715 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3720 self->applyLin(1,val);
3721 Py_XINCREF(trueSelf);
3726 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3728 Py_XINCREF(trueSelf);
3734 Py_XINCREF(trueSelf);
3739 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3740 self->addEqual(aaaa);
3741 Py_XINCREF(trueSelf);
3745 throw INTERP_KERNEL::Exception(msg);
3749 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3751 const char msg[]="Unexpected situation in __sub__ !";
3754 std::vector<int> aa;
3755 DataArrayIntTuple *aaa;
3757 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3762 MCAuto<DataArrayInt> ret=self->deepCopy();
3763 ret->applyLin(1,-val);
3768 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3769 return DataArrayInt::Substract(self,aaaa);
3773 return DataArrayInt::Substract(self,a);
3777 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3778 return DataArrayInt::Substract(self,aaaa);
3781 throw INTERP_KERNEL::Exception(msg);
3785 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3787 const char msg[]="Unexpected situation in __rsub__ !";
3790 std::vector<int> aa;
3791 DataArrayIntTuple *aaa;
3793 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3798 MCAuto<DataArrayInt> ret=self->deepCopy();
3799 ret->applyLin(-1,val);
3804 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3805 return DataArrayInt::Substract(aaaa,self);
3809 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3810 return DataArrayInt::Substract(aaaa,self);
3813 throw INTERP_KERNEL::Exception(msg);
3817 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3819 const char msg[]="Unexpected situation in __isub__ !";
3822 std::vector<int> aa;
3823 DataArrayIntTuple *aaa;
3825 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3830 self->applyLin(1,-val);
3831 Py_XINCREF(trueSelf);
3836 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3837 self->substractEqual(bb);
3838 Py_XINCREF(trueSelf);
3843 self->substractEqual(a);
3844 Py_XINCREF(trueSelf);
3849 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3850 self->substractEqual(aaaa);
3851 Py_XINCREF(trueSelf);
3855 throw INTERP_KERNEL::Exception(msg);
3859 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3861 const char msg[]="Unexpected situation in __mul__ !";
3864 std::vector<int> aa;
3865 DataArrayIntTuple *aaa;
3867 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3872 MCAuto<DataArrayInt> ret=self->deepCopy();
3873 ret->applyLin(val,0);
3878 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3879 return DataArrayInt::Multiply(self,aaaa);
3883 return DataArrayInt::Multiply(self,a);
3887 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3888 return DataArrayInt::Multiply(self,aaaa);
3891 throw INTERP_KERNEL::Exception(msg);
3895 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3897 const char msg[]="Unexpected situation in __rmul__ !";
3900 std::vector<int> aa;
3901 DataArrayIntTuple *aaa;
3903 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3908 MCAuto<DataArrayInt> ret=self->deepCopy();
3909 ret->applyLin(val,0);
3914 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3915 return DataArrayInt::Multiply(self,aaaa);
3919 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3920 return DataArrayInt::Multiply(self,aaaa);
3923 throw INTERP_KERNEL::Exception(msg);
3927 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3929 const char msg[]="Unexpected situation in __imul__ !";
3932 std::vector<int> aa;
3933 DataArrayIntTuple *aaa;
3935 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3940 self->applyLin(val,0);
3941 Py_XINCREF(trueSelf);
3946 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3947 self->multiplyEqual(bb);
3948 Py_XINCREF(trueSelf);
3953 self->multiplyEqual(a);
3954 Py_XINCREF(trueSelf);
3959 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3960 self->multiplyEqual(aaaa);
3961 Py_XINCREF(trueSelf);
3965 throw INTERP_KERNEL::Exception(msg);
3969 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3971 const char msg[]="Unexpected situation in __div__ !";
3974 std::vector<int> aa;
3975 DataArrayIntTuple *aaa;
3977 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3982 MCAuto<DataArrayInt> ret=self->deepCopy();
3983 ret->applyDivideBy(val);
3988 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3989 return DataArrayInt::Divide(self,aaaa);
3993 return DataArrayInt::Divide(self,a);
3997 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3998 return DataArrayInt::Divide(self,aaaa);
4001 throw INTERP_KERNEL::Exception(msg);
4005 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4007 const char msg[]="Unexpected situation in __rdiv__ !";
4010 std::vector<int> aa;
4011 DataArrayIntTuple *aaa;
4013 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4018 MCAuto<DataArrayInt> ret=self->deepCopy();
4024 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4025 return DataArrayInt::Divide(aaaa,self);
4029 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4030 return DataArrayInt::Divide(aaaa,self);
4033 throw INTERP_KERNEL::Exception(msg);
4037 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4039 const char msg[]="Unexpected situation in __idiv__ !";
4042 std::vector<int> aa;
4043 DataArrayIntTuple *aaa;
4045 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4050 self->applyDivideBy(val);
4051 Py_XINCREF(trueSelf);
4056 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4057 self->divideEqual(bb);
4058 Py_XINCREF(trueSelf);
4063 self->divideEqual(a);
4064 Py_XINCREF(trueSelf);
4069 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4070 self->divideEqual(aaaa);
4071 Py_XINCREF(trueSelf);
4075 throw INTERP_KERNEL::Exception(msg);
4079 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4081 const char msg[]="Unexpected situation in __mod__ !";
4084 std::vector<int> aa;
4085 DataArrayIntTuple *aaa;
4087 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4092 MCAuto<DataArrayInt> ret=self->deepCopy();
4093 ret->applyModulus(val);
4098 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4099 return DataArrayInt::Modulus(self,aaaa);
4103 return DataArrayInt::Modulus(self,a);
4107 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4108 return DataArrayInt::Modulus(self,aaaa);
4111 throw INTERP_KERNEL::Exception(msg);
4115 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4117 const char msg[]="Unexpected situation in __rmod__ !";
4120 std::vector<int> aa;
4121 DataArrayIntTuple *aaa;
4123 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4128 MCAuto<DataArrayInt> ret=self->deepCopy();
4129 ret->applyRModulus(val);
4134 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4135 return DataArrayInt::Modulus(aaaa,self);
4139 return DataArrayInt::Modulus(a,self);
4143 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4144 return DataArrayInt::Modulus(aaaa,self);
4147 throw INTERP_KERNEL::Exception(msg);
4151 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4153 const char msg[]="Unexpected situation in __imod__ !";
4156 std::vector<int> aa;
4157 DataArrayIntTuple *aaa;
4159 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4164 self->applyModulus(val);
4165 Py_XINCREF(trueSelf);
4170 self->modulusEqual(a);
4171 Py_XINCREF(trueSelf);
4176 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4177 self->modulusEqual(aaaa);
4178 Py_XINCREF(trueSelf);
4182 throw INTERP_KERNEL::Exception(msg);
4186 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4188 const char msg[]="Unexpected situation in __pow__ !";
4191 std::vector<int> aa;
4192 DataArrayIntTuple *aaa;
4194 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4199 MCAuto<DataArrayInt> ret=self->deepCopy();
4205 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4206 return DataArrayInt::Pow(self,aaaa);
4210 return DataArrayInt::Pow(self,a);
4214 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4215 return DataArrayInt::Pow(self,aaaa);
4218 throw INTERP_KERNEL::Exception(msg);
4222 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4224 const char msg[]="Unexpected situation in __rpow__ !";
4227 std::vector<int> aa;
4228 DataArrayIntTuple *aaa;
4230 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4235 MCAuto<DataArrayInt> ret=self->deepCopy();
4236 ret->applyRPow(val);
4241 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4242 return DataArrayInt::Pow(aaaa,self);
4246 return DataArrayInt::Pow(a,self);
4250 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4251 return DataArrayInt::Pow(aaaa,self);
4254 throw INTERP_KERNEL::Exception(msg);
4258 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4260 const char msg[]="Unexpected situation in __ipow__ !";
4263 std::vector<int> aa;
4264 DataArrayIntTuple *aaa;
4266 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4271 self->applyPow(val);
4272 Py_XINCREF(trueSelf);
4278 Py_XINCREF(trueSelf);
4283 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4284 self->powEqual(aaaa);
4285 Py_XINCREF(trueSelf);
4289 throw INTERP_KERNEL::Exception(msg);
4293 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4295 std::ostringstream oss;
4296 self->reprQuickOverview(oss);
4300 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4302 int szArr,sw,iTypppArr;
4303 std::vector<int> stdvecTyyppArr;
4304 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4305 self->pushBackValsSilent(tmp,tmp+szArr);
4308 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4310 std::vector<int> ret1;
4311 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4312 std::size_t sz=ret0.size();
4313 PyObject *pyRet=PyTuple_New(2);
4314 PyObject *pyRet0=PyList_New((int)sz);
4315 PyObject *pyRet1=PyList_New((int)sz);
4316 for(std::size_t i=0;i<sz;i++)
4318 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4319 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4321 PyTuple_SetItem(pyRet,0,pyRet0);
4322 PyTuple_SetItem(pyRet,1,pyRet1);
4326 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4328 DataArrayInt *ret0=0,*ret1=0;
4329 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4330 PyObject *pyRet=PyTuple_New(2);
4331 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4332 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4336 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4339 bool ret(self->isRange(a,b,c));
4340 PyObject *pyRet=PyTuple_New(2);
4341 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4343 PyTuple_SetItem(pyRet,0,ret0Py);
4345 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4351 PyTuple_SetItem(pyRet,1,ret1Py);
4356 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4358 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4361 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4364 if(!self->isAllocated())
4365 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4366 PyObject *ret(PyTuple_New(1));
4367 PyObject *ret0(PyDict_New());
4368 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4369 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4370 PyObject *tmp1(PyInt_FromLong(0));
4371 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4372 PyTuple_SetItem(ret,0,ret0);
4376 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4382 class DataArrayIntTuple;
4384 class DataArrayIntIterator
4387 DataArrayIntIterator(DataArrayInt *da);
4388 ~DataArrayIntIterator();
4393 DataArrayIntTuple *ret=self->nextt();
4395 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4398 PyErr_SetString(PyExc_StopIteration,"No more data.");
4405 class DataArrayIntTuple
4408 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4409 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4412 std::string __str__() const throw(INTERP_KERNEL::Exception)
4414 return self->repr();
4417 int __int__() const throw(INTERP_KERNEL::Exception)
4419 return self->intValue();
4422 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4424 return self->buildDAInt(1,self->getNumberOfCompo());
4427 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4429 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4430 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4431 Py_XINCREF(trueSelf);
4435 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4437 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4438 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4439 Py_XINCREF(trueSelf);
4443 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4445 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4446 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4447 Py_XINCREF(trueSelf);
4451 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4453 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4454 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4455 Py_XINCREF(trueSelf);
4459 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4461 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4462 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4463 Py_XINCREF(trueSelf);
4467 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4469 return PyInt_FromLong(self->getNumberOfCompo());
4472 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4474 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4477 std::vector<int> multiVal;
4478 std::pair<int, std::pair<int,int> > slic;
4479 MEDCoupling::DataArrayInt *daIntTyypp=0;
4480 const int *pt=self->getConstPointer();
4481 int nbc=self->getNumberOfCompo();
4482 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4489 std::ostringstream oss;
4490 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4491 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4495 return PyInt_FromLong(pt[singleVal]);
4499 return PyInt_FromLong(pt[nbc+singleVal]);
4502 std::ostringstream oss;
4503 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4504 throw INTERP_KERNEL::Exception(oss.str().c_str());
4510 PyObject *t=PyTuple_New(multiVal.size());
4511 for(int j=0;j<(int)multiVal.size();j++)
4513 int cid=multiVal[j];
4516 std::ostringstream oss;
4517 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4518 throw INTERP_KERNEL::Exception(oss.str().c_str());
4520 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4526 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4527 PyObject *t=PyTuple_New(sz);
4528 for(int j=0;j<sz;j++)
4529 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4533 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4537 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4539 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4540 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4543 std::vector<int> multiValV;
4544 std::pair<int, std::pair<int,int> > slicV;
4545 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4546 int nbc=self->getNumberOfCompo();
4547 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4549 std::vector<int> multiVal;
4550 std::pair<int, std::pair<int,int> > slic;
4551 MEDCoupling::DataArrayInt *daIntTyypp=0;
4552 int *pt=self->getPointer();
4553 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4560 std::ostringstream oss;
4561 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4562 throw INTERP_KERNEL::Exception(oss.str().c_str());
4568 pt[singleVal]=singleValV;
4573 if(multiValV.size()!=1)
4575 std::ostringstream oss;
4576 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4577 throw INTERP_KERNEL::Exception(oss.str().c_str());
4579 pt[singleVal]=multiValV[0];
4584 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4588 throw INTERP_KERNEL::Exception(msg);
4597 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4601 std::ostringstream oss;
4602 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4603 throw INTERP_KERNEL::Exception(oss.str().c_str());
4611 if(multiVal.size()!=multiValV.size())
4613 std::ostringstream oss;
4614 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4615 throw INTERP_KERNEL::Exception(oss.str().c_str());
4617 for(int i=0;i<(int)multiVal.size();i++)
4619 int pos=multiVal[i];
4622 std::ostringstream oss;
4623 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4624 throw INTERP_KERNEL::Exception(oss.str().c_str());
4626 pt[multiVal[i]]=multiValV[i];
4632 const int *ptV=daIntTyyppV->getConstPointer();
4633 if(nbc>daIntTyyppV->getNumberOfCompo())
4635 std::ostringstream oss;
4636 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4637 throw INTERP_KERNEL::Exception(oss.str().c_str());
4639 std::copy(ptV,ptV+nbc,pt);
4643 throw INTERP_KERNEL::Exception(msg);
4648 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4653 for(int j=0;j<sz;j++)
4654 pt[slic.first+j*slic.second.second]=singleValV;
4659 if(sz!=(int)multiValV.size())
4661 std::ostringstream oss;
4662 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4663 throw INTERP_KERNEL::Exception(oss.str().c_str());
4665 for(int j=0;j<sz;j++)
4666 pt[slic.first+j*slic.second.second]=multiValV[j];
4671 const int *ptV=daIntTyyppV->getConstPointer();
4672 if(sz>daIntTyyppV->getNumberOfCompo())
4674 std::ostringstream oss;
4675 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4676 throw INTERP_KERNEL::Exception(oss.str().c_str());
4678 for(int j=0;j<sz;j++)
4679 pt[slic.first+j*slic.second.second]=ptV[j];
4683 throw INTERP_KERNEL::Exception(msg);
4687 throw INTERP_KERNEL::Exception(msg);
4693 class DataArrayChar : public DataArray
4696 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4697 int getHashCode() const throw(INTERP_KERNEL::Exception);
4698 bool empty() const throw(INTERP_KERNEL::Exception);
4699 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4700 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4701 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4702 char popBackSilent() throw(INTERP_KERNEL::Exception);
4703 void pack() const throw(INTERP_KERNEL::Exception);
4704 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4705 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4706 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4707 void reverse() throw(INTERP_KERNEL::Exception);
4708 void fillWithZero() throw(INTERP_KERNEL::Exception);
4709 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4710 std::string repr() const throw(INTERP_KERNEL::Exception);
4711 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4712 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4713 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4714 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4715 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4716 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4717 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4718 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4719 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4720 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4721 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4722 char front() const throw(INTERP_KERNEL::Exception);
4723 char back() const throw(INTERP_KERNEL::Exception);
4724 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4725 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4726 char *getPointer() throw(INTERP_KERNEL::Exception);
4727 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4728 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4729 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4730 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4731 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4732 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4733 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4734 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4735 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4736 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4737 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4740 int __len__() const throw(INTERP_KERNEL::Exception)
4742 if(self->isAllocated())
4744 return self->getNumberOfTuples();
4748 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4752 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4755 bool ret0=self->isEqualIfNotWhy(other,ret1);
4756 PyObject *ret=PyTuple_New(2);
4757 PyObject *ret0Py=ret0?Py_True:Py_False;
4759 PyTuple_SetItem(ret,0,ret0Py);
4760 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4764 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4767 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4768 if (!SWIG_IsOK(res1))
4771 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4772 if(size!=self->getNumberOfTuples())
4774 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4776 return self->renumber(tmp);
4780 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4782 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4783 da2->checkAllocated();
4784 int size=self->getNumberOfTuples();
4785 if(size!=self->getNumberOfTuples())
4787 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4789 return self->renumber(da2->getConstPointer());
4793 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4796 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4797 if (!SWIG_IsOK(res1))
4800 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4801 if(size!=self->getNumberOfTuples())
4803 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4805 return self->renumberR(tmp);
4809 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4811 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4812 da2->checkAllocated();
4813 int size=self->getNumberOfTuples();
4814 if(size!=self->getNumberOfTuples())
4816 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4818 return self->renumberR(da2->getConstPointer());
4822 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4825 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4826 if (!SWIG_IsOK(res1))
4829 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4830 if(size!=self->getNumberOfTuples())
4832 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4834 return self->renumberAndReduce(tmp,newNbOfTuple);
4838 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4840 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4841 da2->checkAllocated();
4842 int size=self->getNumberOfTuples();
4843 if(size!=self->getNumberOfTuples())
4845 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4847 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4851 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4853 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4854 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4855 return DataArrayChar::Aggregate(tmp);
4858 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4860 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4861 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4862 return DataArrayChar::Meld(tmp);
4867 class DataArrayByteIterator;
4869 class DataArrayByte : public DataArrayChar
4872 static DataArrayByte *New();
4873 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4874 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4875 char byteValue() const throw(INTERP_KERNEL::Exception);
4878 DataArrayByte() throw(INTERP_KERNEL::Exception)
4880 return DataArrayByte::New();
4883 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4885 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) !";
4886 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4890 if(PyInt_Check(nbOfTuples))
4892 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4894 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4897 if(PyInt_Check(nbOfComp))
4898 {//DataArrayByte.New([1,3,4,5],2,2)
4899 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4901 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4902 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4903 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4904 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4908 throw INTERP_KERNEL::Exception(msg);
4911 {//DataArrayByte.New([1,3,4],3)
4912 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4914 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4915 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4920 throw INTERP_KERNEL::Exception(msg);
4923 {// DataArrayByte.New([1,3,4])
4924 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4925 int tmpp1=-1,tmpp2=-1;
4926 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4927 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4931 else if(PyInt_Check(elt0))
4933 int nbOfTuples1=PyInt_AS_LONG(elt0);
4935 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4940 if(PyInt_Check(nbOfTuples))
4941 {//DataArrayByte.New(5,2)
4942 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4944 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4945 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4946 ret->alloc(nbOfTuples1,nbOfCompo);
4950 throw INTERP_KERNEL::Exception(msg);
4953 throw INTERP_KERNEL::Exception(msg);
4956 {//DataArrayByte.New(5)
4957 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4958 ret->alloc(nbOfTuples1,1);
4963 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4964 {//DataArrayDouble.New(numpyArray)
4965 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4969 throw INTERP_KERNEL::Exception(msg);
4972 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4974 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4977 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4979 std::ostringstream oss;
4980 self->reprQuickOverview(oss);
4984 int __int__() const throw(INTERP_KERNEL::Exception)
4986 return (int) self->byteValue();
4989 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4991 return self->iterator();
4994 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4996 return (int)self->getIJ(tupleId,compoId);
4999 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5001 return (int)self->getIJSafe(tupleId,compoId);
5004 std::string __str__() const throw(INTERP_KERNEL::Exception)
5006 return self->repr();
5009 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5011 const char *vals=self->getConstPointer();
5012 int nbOfComp=self->getNumberOfComponents();
5013 int nbOfTuples=self->getNumberOfTuples();
5014 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5017 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5020 int ival=-1; std::vector<int> ivval;
5021 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5022 std::vector<char> vals(sz);
5023 std::copy(pt,pt+sz,vals.begin());
5024 return self->presenceOfTuple(vals);
5027 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5030 int ival=-1; std::vector<int> ivval;
5031 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5032 std::vector<char> vals2(sz);
5033 std::copy(pt,pt+sz,vals2.begin());
5034 return self->presenceOfValue(vals2);
5037 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5040 int ival=-1; std::vector<int> ivval;
5041 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5042 std::vector<char> vals2(sz);
5043 std::copy(pt,pt+sz,vals2.begin());
5044 return self->findIdFirstEqual(vals2);
5047 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5050 int ival=-1; std::vector<int> ivval;
5051 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5052 std::vector<char> vals(sz);
5053 std::copy(pt,pt+sz,vals.begin());
5054 return self->findIdFirstEqualTuple(vals);
5057 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5060 int ival=-1; std::vector<int> ivval;
5061 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5062 std::vector<char> vals(sz);
5063 std::copy(pt,pt+sz,vals.begin());
5064 return self->findIdSequence(vals);
5067 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5069 int sz=self->getNumberOfComponents();
5070 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5071 self->getTuple(tupleId,tmp);
5072 PyObject *ret=PyTuple_New(sz);
5073 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5077 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5080 int r1=(int)self->getMaxValue(tmp);
5081 PyObject *ret=PyTuple_New(2);
5082 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5083 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5087 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5090 int r1=(int)self->getMinValue(tmp);
5091 PyObject *ret=PyTuple_New(2);
5092 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5093 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5097 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5099 int nbOfCompo=self->getNumberOfComponents();
5104 if(PyInt_Check(obj))
5106 int val=(int)PyInt_AS_LONG(obj);
5107 return self->findIdFirstEqual(val);
5110 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5113 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5117 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5119 int nbOfCompo=self->getNumberOfComponents();
5126 if(PyInt_Check(obj))
5128 int val=(int)PyInt_AS_LONG(obj);
5129 return self->presenceOfValue(val);
5132 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5135 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5140 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5142 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5147 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5149 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5152 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5155 if(!self->isAllocated())
5156 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5157 PyObject *ret(PyTuple_New(1));
5158 PyObject *ret0(PyDict_New());
5159 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5160 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5161 PyObject *tmp1(PyInt_FromLong(0));
5162 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5163 PyTuple_SetItem(ret,0,ret0);
5167 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5171 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5173 self->checkAllocated();
5174 const char msg[]="Unexpected situation in __setitem__ !";
5175 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5178 std::vector<int> v1;
5180 DataArrayIntTuple *dd1=0;
5181 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5183 std::vector<int> vt1,vc1;
5184 std::pair<int, std::pair<int,int> > pt1,pc1;
5185 DataArrayInt *dt1=0,*dc1=0;
5186 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5187 MCAuto<DataArrayInt> tmp;
5195 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5198 throw INTERP_KERNEL::Exception(msg);
5207 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5210 throw INTERP_KERNEL::Exception(msg);
5219 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5222 throw INTERP_KERNEL::Exception(msg);
5231 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5234 throw INTERP_KERNEL::Exception(msg);
5243 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5246 throw INTERP_KERNEL::Exception(msg);
5255 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5258 throw INTERP_KERNEL::Exception(msg);
5267 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5270 throw INTERP_KERNEL::Exception(msg);
5279 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5282 throw INTERP_KERNEL::Exception(msg);
5291 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5294 throw INTERP_KERNEL::Exception(msg);
5303 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5306 throw INTERP_KERNEL::Exception(msg);
5315 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5318 throw INTERP_KERNEL::Exception(msg);
5327 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5330 throw INTERP_KERNEL::Exception(msg);
5339 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5342 throw INTERP_KERNEL::Exception(msg);
5351 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5354 throw INTERP_KERNEL::Exception(msg);
5363 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5366 throw INTERP_KERNEL::Exception(msg);
5375 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5378 throw INTERP_KERNEL::Exception(msg);
5383 throw INTERP_KERNEL::Exception(msg);
5390 class DataArrayByteTuple;
5392 class DataArrayByteIterator
5395 DataArrayByteIterator(DataArrayByte *da);
5396 ~DataArrayByteIterator();
5399 class DataArrayByteTuple
5402 std::string repr() const throw(INTERP_KERNEL::Exception);
5403 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5406 std::string __str__() const throw(INTERP_KERNEL::Exception)
5408 return self->repr();
5411 char __int__() const throw(INTERP_KERNEL::Exception)
5413 return self->byteValue();
5416 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5418 return self->buildDAByte(1,self->getNumberOfCompo());
5423 class DataArrayAsciiCharIterator;
5425 class DataArrayAsciiChar : public DataArrayChar
5428 static DataArrayAsciiChar *New();
5429 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5430 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5431 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5434 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5436 return DataArrayAsciiChar::New();
5439 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5441 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) !";
5442 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5446 if(PyInt_Check(nbOfTuples))
5448 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5450 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5453 if(PyInt_Check(nbOfComp))
5454 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5455 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5457 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5458 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5459 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5460 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5464 throw INTERP_KERNEL::Exception(msg);
5467 {//DataArrayAsciiChar.New([1,3,4],3)
5468 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5470 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5471 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5475 else if(PyString_Check(nbOfTuples))
5477 if(PyString_Size(nbOfTuples)!=1)
5478 throw INTERP_KERNEL::Exception(msg);
5479 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5480 std::vector<std::string> tmp;
5481 if(fillStringVector(elt0,tmp))
5482 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5484 throw INTERP_KERNEL::Exception(msg);
5487 throw INTERP_KERNEL::Exception(msg);
5491 std::vector<std::string> tmmp;
5492 if(fillStringVector(elt0,tmmp))
5493 //DataArrayAsciiChar.New(["abc","de","fghi"])
5494 return DataArrayAsciiChar::New(tmmp,' ');
5497 // DataArrayAsciiChar.New([1,3,4])
5498 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5499 int tmpp1=-1,tmpp2=-1;
5500 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5501 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5506 else if(PyInt_Check(elt0))
5508 int nbOfTuples1=PyInt_AS_LONG(elt0);
5510 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5515 if(PyInt_Check(nbOfTuples))
5516 {//DataArrayAsciiChar.New(5,2)
5517 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5519 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5520 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5521 ret->alloc(nbOfTuples1,nbOfCompo);
5525 throw INTERP_KERNEL::Exception(msg);
5528 throw INTERP_KERNEL::Exception(msg);
5531 {//DataArrayAsciiChar.New(5)
5532 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5533 ret->alloc(nbOfTuples1,1);
5538 throw INTERP_KERNEL::Exception(msg);
5541 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5543 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5546 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5548 std::ostringstream oss;
5549 self->reprQuickOverview(oss);
5553 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5555 return self->iterator();
5558 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5560 char tmp[2]; tmp[1]='\0';
5561 tmp[0]=self->getIJ(tupleId,compoId);
5562 return std::string(tmp);
5565 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5567 char tmp[2]; tmp[1]='\0';
5568 tmp[0]=self->getIJSafe(tupleId,compoId);
5569 return std::string(tmp);
5572 std::string __str__() const throw(INTERP_KERNEL::Exception)
5574 return self->repr();
5577 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5579 const char *vals=self->getConstPointer();
5580 int nbOfComp=self->getNumberOfComponents();
5581 int nbOfTuples=self->getNumberOfTuples();
5582 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5585 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5587 if(PyString_Check(tupl))
5589 Py_ssize_t sz=PyString_Size(tupl);
5590 std::vector<char> vals(sz);
5591 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5592 return self->presenceOfTuple(vals);
5595 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5598 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5600 if(PyString_Check(vals))
5602 Py_ssize_t sz=PyString_Size(vals);
5603 std::vector<char> vals2(sz);
5604 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5605 return self->presenceOfValue(vals2);
5608 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5611 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5613 if(PyString_Check(vals))
5615 Py_ssize_t sz=PyString_Size(vals);
5616 std::vector<char> vals2(sz);
5617 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5618 return self->findIdFirstEqual(vals2);
5621 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5624 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5626 if(PyString_Check(tupl))
5628 Py_ssize_t sz=PyString_Size(tupl);
5629 std::vector<char> vals(sz);
5630 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5631 return self->findIdFirstEqualTuple(vals);
5634 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5637 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5639 if(PyString_Check(strOrListOfInt))
5641 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5642 std::vector<char> vals(sz);
5643 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5644 return self->findIdSequence(vals);
5647 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5650 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5652 int sz=self->getNumberOfComponents();
5653 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5654 self->getTuple(tupleId,tmp);
5655 return PyString_FromString(tmp);
5658 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5661 char tmp2[2]; tmp2[1]='\0';
5662 tmp2[0]=self->getMaxValue(tmp);
5663 PyObject *ret=PyTuple_New(2);
5664 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5665 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5669 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5672 char tmp2[2]; tmp2[1]='\0';
5673 tmp2[0]=self->getMinValue(tmp);
5674 PyObject *ret=PyTuple_New(2);
5675 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5676 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5680 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5682 int nbOfCompo=self->getNumberOfComponents();
5687 if(PyString_Check(obj))
5689 Py_ssize_t sz=PyString_Size(obj);
5690 char *pt=PyString_AsString(obj);
5692 return self->findIdFirstEqual(pt[0]);
5694 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5697 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5700 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5704 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5706 int nbOfCompo=self->getNumberOfComponents();
5713 if(PyString_Check(obj))
5715 Py_ssize_t sz=PyString_Size(obj);
5716 char *pt=PyString_AsString(obj);
5718 return self->presenceOfValue(pt[0]);
5720 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5723 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5726 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5730 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5733 std::vector<int> stdvecTyyppArr;
5734 std::pair<int, std::pair<int,int> > sTyyppArr;
5735 MEDCoupling::DataArrayInt *daIntTyypp=0;
5736 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5740 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5742 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5744 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5746 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5748 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5752 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5754 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.";
5756 std::vector<int> stdvecTyyppArr;
5757 std::pair<int, std::pair<int,int> > sTyyppArr;
5758 MEDCoupling::DataArrayInt *daIntTyypp=0;
5759 int nbOfCompo=self->getNumberOfComponents();
5760 int nbOfTuples=self->getNumberOfTuples();
5761 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5763 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5764 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5773 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5779 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5780 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5783 //value vector<string>
5786 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5787 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5790 //value DataArrayChar
5793 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5797 throw INTERP_KERNEL::Exception(msg);
5801 {//obj list-tuple[int]
5807 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5813 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5814 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5817 //value vector<string>
5820 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5821 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5824 //value DataArrayChar
5827 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5831 throw INTERP_KERNEL::Exception(msg);
5842 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5848 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5849 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5852 //value vector<string>
5855 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5856 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5859 //value DataArrayChar
5862 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5866 throw INTERP_KERNEL::Exception(msg);
5877 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5883 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5884 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5887 //value vector<string>
5890 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5891 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5894 //value DataArrayChar
5897 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5901 throw INTERP_KERNEL::Exception(msg);
5906 throw INTERP_KERNEL::Exception(msg);
5912 class DataArrayAsciiCharTuple;
5914 class DataArrayAsciiCharIterator
5917 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5918 ~DataArrayAsciiCharIterator();
5923 DataArrayAsciiCharTuple *ret=self->nextt();
5925 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5928 PyErr_SetString(PyExc_StopIteration,"No more data.");
5935 class DataArrayAsciiCharTuple
5938 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5939 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5942 std::string __str__() const throw(INTERP_KERNEL::Exception)
5944 return self->repr();
5947 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5949 return self->buildDAAsciiChar(1,self->getNumberOfCompo());