1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
22 %typemap(out) MEDCoupling::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) MEDCoupling::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
45 %newobject MEDCoupling::DataArray::deepCopy;
46 %newobject MEDCoupling::DataArray::buildNewEmptyInstance;
47 %newobject MEDCoupling::DataArray::selectByTupleRanges;
48 %newobject MEDCoupling::DataArray::selectByTupleId;
49 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
50 %newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
51 %newobject MEDCoupling::DataArray::Aggregate;
52 %newobject MEDCoupling::DataArrayInt::New;
53 %newobject MEDCoupling::DataArrayInt::__iter__;
54 %newobject MEDCoupling::DataArrayInt::selectPartDef;
55 %newobject MEDCoupling::DataArrayInt::convertToDblArr;
56 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
57 %newobject MEDCoupling::DataArrayInt::subArray;
58 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
59 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
60 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
61 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
62 %newobject MEDCoupling::DataArrayInt::renumber;
63 %newobject MEDCoupling::DataArrayInt::renumberR;
64 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
65 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
66 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
67 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
68 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
69 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
70 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
71 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
72 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
73 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
74 %newobject MEDCoupling::DataArrayInt::negate;
75 %newobject MEDCoupling::DataArrayInt::computeAbs;
76 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
77 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
78 %newobject MEDCoupling::DataArrayInt::findIdsStricltyNegative;
79 %newobject MEDCoupling::DataArrayInt::Aggregate;
80 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
81 %newobject MEDCoupling::DataArrayInt::Meld;
82 %newobject MEDCoupling::DataArrayInt::Add;
83 %newobject MEDCoupling::DataArrayInt::Substract;
84 %newobject MEDCoupling::DataArrayInt::Multiply;
85 %newobject MEDCoupling::DataArrayInt::Divide;
86 %newobject MEDCoupling::DataArrayInt::Pow;
87 %newobject MEDCoupling::DataArrayInt::BuildUnion;
88 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
89 %newobject MEDCoupling::DataArrayInt::Range;
90 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
91 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
92 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
93 %newobject MEDCoupling::DataArrayInt::buildComplement;
94 %newobject MEDCoupling::DataArrayInt::buildUnion;
95 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
96 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
97 %newobject MEDCoupling::DataArrayInt::buildIntersection;
98 %newobject MEDCoupling::DataArrayInt::buildUnique;
99 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
100 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
101 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
102 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
103 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
104 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
105 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
106 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
107 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
108 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
109 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
110 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
111 %newobject MEDCoupling::DataArrayInt::__neg__;
112 %newobject MEDCoupling::DataArrayInt::__add__;
113 %newobject MEDCoupling::DataArrayInt::__radd__;
114 %newobject MEDCoupling::DataArrayInt::__sub__;
115 %newobject MEDCoupling::DataArrayInt::__rsub__;
116 %newobject MEDCoupling::DataArrayInt::__mul__;
117 %newobject MEDCoupling::DataArrayInt::__rmul__;
118 %newobject MEDCoupling::DataArrayInt::__div__;
119 %newobject MEDCoupling::DataArrayInt::__rdiv__;
120 %newobject MEDCoupling::DataArrayInt::__mod__;
121 %newobject MEDCoupling::DataArrayInt::__rmod__;
122 %newobject MEDCoupling::DataArrayInt::__pow__;
123 %newobject MEDCoupling::DataArrayInt::__rpow__;
124 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
125 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
126 %newobject MEDCoupling::DataArrayChar::renumber;
127 %newobject MEDCoupling::DataArrayChar::renumberR;
128 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
129 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
130 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
131 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
132 %newobject MEDCoupling::DataArrayChar::Aggregate;
133 %newobject MEDCoupling::DataArrayChar::Meld;
134 %newobject MEDCoupling::DataArrayByte::New;
135 %newobject MEDCoupling::DataArrayByte::__iter__;
136 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
137 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
138 %newobject MEDCoupling::DataArrayChar::subArray;
139 %newobject MEDCoupling::DataArrayAsciiChar::New;
140 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
141 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
142 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
143 %newobject MEDCoupling::DataArrayDouble::New;
144 %newobject MEDCoupling::DataArrayDouble::__iter__;
145 %newobject MEDCoupling::DataArrayDouble::selectPartDef;
146 %newobject MEDCoupling::DataArrayDouble::convertToIntArr;
147 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
148 %newobject MEDCoupling::DataArrayDouble::Aggregate;
149 %newobject MEDCoupling::DataArrayDouble::Meld;
150 %newobject MEDCoupling::DataArrayDouble::Dot;
151 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
152 %newobject MEDCoupling::DataArrayDouble::Add;
153 %newobject MEDCoupling::DataArrayDouble::Substract;
154 %newobject MEDCoupling::DataArrayDouble::Multiply;
155 %newobject MEDCoupling::DataArrayDouble::Divide;
156 %newobject MEDCoupling::DataArrayDouble::Pow;
157 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
158 %newobject MEDCoupling::DataArrayDouble::subArray;
159 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
160 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
161 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
162 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
163 %newobject MEDCoupling::DataArrayDouble::negate;
164 %newobject MEDCoupling::DataArrayDouble::computeAbs;
165 %newobject MEDCoupling::DataArrayDouble::applyFunc;
166 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
167 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
168 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
169 %newobject MEDCoupling::DataArrayDouble::determinant;
170 %newobject MEDCoupling::DataArrayDouble::eigenValues;
171 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
172 %newobject MEDCoupling::DataArrayDouble::inverse;
173 %newobject MEDCoupling::DataArrayDouble::trace;
174 %newobject MEDCoupling::DataArrayDouble::deviator;
175 %newobject MEDCoupling::DataArrayDouble::magnitude;
176 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
177 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
178 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
179 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
180 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
181 %newobject MEDCoupling::DataArrayDouble::renumber;
182 %newobject MEDCoupling::DataArrayDouble::renumberR;
183 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
184 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
185 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
186 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
187 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
188 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
189 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
190 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
191 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
192 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
193 %newobject MEDCoupling::DataArrayDouble::cartesianize;
194 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
195 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
196 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
197 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
198 %newobject MEDCoupling::DataArrayDouble::__neg__;
199 %newobject MEDCoupling::DataArrayDouble::__radd__;
200 %newobject MEDCoupling::DataArrayDouble::__rsub__;
201 %newobject MEDCoupling::DataArrayDouble::__rmul__;
202 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
203 %newobject MEDCoupling::DataArrayDouble::__pow__;
204 %newobject MEDCoupling::DataArrayDouble::__rpow__;
205 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
207 %newobject MEDCoupling::PartDefinition::New;
208 %newobject MEDCoupling::PartDefinition::toDAI;
209 %newobject MEDCoupling::PartDefinition::__add__;
210 %newobject MEDCoupling::PartDefinition::composeWith;
211 %newobject MEDCoupling::PartDefinition::tryToSimplify;
212 %newobject MEDCoupling::DataArrayPartDefinition::New;
213 %newobject MEDCoupling::SlicePartDefinition::New;
216 %feature("unref") DataArray "$this->decrRef();"
217 %feature("unref") DataArrayDouble "$this->decrRef();"
218 %feature("unref") DataArrayInt "$this->decrRef();"
219 %feature("unref") DataArrayChar "$this->decrRef();"
220 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
221 %feature("unref") DataArrayByte "$this->decrRef();"
223 %feature("unref") PartDefinition "$this->decrRef();"
224 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
225 %feature("unref") SlicePartDefinition "$this->decrRef();"
227 namespace MEDCoupling
234 } MEDCouplingAxisType;
238 class PartDefinition : public RefCountObject, public TimeLabel
241 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
242 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
243 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
244 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
245 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
246 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
247 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
248 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
251 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
253 return (*self)+other;
256 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
259 bool ret0(self->isEqual(other,ret1));
260 PyObject *ret=PyTuple_New(2);
261 PyObject *ret0Py=ret0?Py_True:Py_False;
263 PyTuple_SetItem(ret,0,ret0Py);
264 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
268 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
270 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
274 virtual ~PartDefinition();
277 class DataArrayPartDefinition : public PartDefinition
280 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
283 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
285 return DataArrayPartDefinition::New(listOfIds);
288 std::string __str__() const throw(INTERP_KERNEL::Exception)
290 return self->getRepr();
293 std::string __repr__() const throw(INTERP_KERNEL::Exception)
295 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
296 oss << self->getRepr();
301 virtual ~DataArrayPartDefinition();
304 class SlicePartDefinition : public PartDefinition
307 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
308 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
311 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
313 return SlicePartDefinition::New(start,stop,step);
316 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
319 self->getSlice(a,b,c);
320 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
323 std::string __str__() const throw(INTERP_KERNEL::Exception)
325 return self->getRepr();
328 std::string __repr__() const throw(INTERP_KERNEL::Exception)
330 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
331 oss << self->getRepr();
336 virtual ~SlicePartDefinition();
339 class DataArray : public RefCountObject, public TimeLabel
342 void setName(const std::string& name);
343 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
344 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
345 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
346 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
347 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
348 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
349 std::string getName() const;
350 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
351 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
352 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
353 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
354 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
355 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
356 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
357 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
358 int getNumberOfComponents() const;
359 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
360 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
361 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
362 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
363 virtual void desallocate() throw(INTERP_KERNEL::Exception);
364 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
365 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
366 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
367 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
368 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
369 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
370 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
371 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
372 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
373 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
374 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
375 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
376 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
377 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
378 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
379 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
380 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
381 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
382 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
383 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
384 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
385 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
386 void updateTime() const;
389 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
391 const std::vector<std::string>& comps=self->getInfoOnComponents();
392 PyObject *ret=PyList_New((int)comps.size());
393 for(int i=0;i<(int)comps.size();i++)
394 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
398 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
400 std::vector<int> tmp;
401 convertPyToNewIntArr3(li,tmp);
402 self->copyPartOfStringInfoFrom(other,tmp);
405 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
407 std::vector<int> tmp;
408 convertPyToNewIntArr3(li,tmp);
409 self->copyPartOfStringInfoFrom2(tmp,other);
412 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
415 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
416 if (!SWIG_IsOK(res1))
419 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
420 if(size!=self->getNumberOfTuples())
422 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
424 self->renumberInPlace(tmp);
428 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
430 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
431 da2->checkAllocated();
432 int size=self->getNumberOfTuples();
433 if(size!=self->getNumberOfTuples())
435 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
437 self->renumberInPlace(da2->getConstPointer());
441 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
444 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
445 if (!SWIG_IsOK(res1))
448 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
449 if(size!=self->getNumberOfTuples())
451 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
453 self->renumberInPlaceR(tmp);
457 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
459 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
460 da2->checkAllocated();
461 int size=self->getNumberOfTuples();
462 if(size!=self->getNumberOfTuples())
464 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
466 self->renumberInPlaceR(da2->getConstPointer());
470 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
471 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
473 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
474 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
475 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
476 DataArrayInt *tuplesSelecPtr2=0;
479 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
481 throw INTERP_KERNEL::Exception(msg);
483 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
486 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
488 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
489 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
492 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
494 std::vector<std::pair<int,int> > ranges;
495 convertPyToVectorPairInt(li,ranges);
496 return self->selectByTupleRanges(ranges);
499 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
502 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
503 if (!SWIG_IsOK(res1))
506 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
507 return self->selectByTupleId(tmp,tmp+size);
511 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
513 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
514 da2->checkAllocated();
515 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
519 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
522 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
523 if (!SWIG_IsOK(res1))
526 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
527 return self->selectByTupleIdSafe(tmp,tmp+size);
531 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
533 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
534 da2->checkAllocated();
535 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
539 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
541 std::vector<int> tmp;
542 convertPyToNewIntArr3(li,tmp);
543 DataArray *ret=self->keepSelectedComponents(tmp);
544 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
547 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
549 if(!PySlice_Check(slic))
550 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
551 Py_ssize_t strt=2,stp=2,step=2;
552 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
553 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
555 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
556 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
559 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
561 if(!PySlice_Check(slic))
562 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
563 Py_ssize_t strt=2,stp=2,step=2;
564 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
565 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
567 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
568 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
571 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
573 if(!PySlice_Check(slic))
574 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
575 Py_ssize_t strt=2,stp=2,step=2;
576 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
577 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
578 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
581 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
583 if(!PySlice_Check(slic))
584 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
585 Py_ssize_t strt=2,stp=2,step=2;
586 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
587 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
588 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
591 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
593 std::vector<const DataArray *> tmp;
594 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
595 return DataArray::Aggregate(tmp);
598 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
600 if(!PySlice_Check(slic))
601 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
602 Py_ssize_t strt=2,stp=2,step=2;
603 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
604 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
605 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
608 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
610 if(!PySlice_Check(slic))
611 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
612 Py_ssize_t strt=2,stp=2,step=2;
613 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
614 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
615 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
618 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
620 PyObject *ret(PyTuple_New(2));
621 std::string a0(self->getName());
622 const std::vector<std::string> &a1(self->getInfoOnComponents());
623 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
626 PyObject *ret1(PyList_New(sz));
627 for(int i=0;i<sz;i++)
628 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
629 PyTuple_SetItem(ret,1,ret1);
634 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
636 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 !";
637 if(!PyTuple_Check(inp))
638 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
639 int sz(PyTuple_Size(inp));
641 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
642 PyObject *a0(PyTuple_GetItem(inp,0));
643 if(!PyString_Check(a0))
644 throw INTERP_KERNEL::Exception(MSG);
645 PyObject *a1(PyTuple_GetItem(inp,1));
646 std::vector<std::string> a1cpp;
647 if(!fillStringVector(a1,a1cpp))
648 throw INTERP_KERNEL::Exception(MSG);
649 self->setName(PyString_AsString(a0));
650 self->setInfoOnComponents(a1cpp);
656 class DataArrayDoubleIterator;
658 class DataArrayDouble : public DataArray
661 static DataArrayDouble *New();
662 double doubleValue() const throw(INTERP_KERNEL::Exception);
663 bool empty() const throw(INTERP_KERNEL::Exception);
664 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
665 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
666 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
667 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
668 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
669 double popBackSilent() throw(INTERP_KERNEL::Exception);
670 void pack() const throw(INTERP_KERNEL::Exception);
671 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
672 void fillWithZero() throw(INTERP_KERNEL::Exception);
673 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
674 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
675 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
676 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
677 void reverse() throw(INTERP_KERNEL::Exception);
678 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
679 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
680 std::string repr() const throw(INTERP_KERNEL::Exception);
681 std::string reprZip() const throw(INTERP_KERNEL::Exception);
682 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
683 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
684 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
685 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
686 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
687 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
688 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
689 void transpose() throw(INTERP_KERNEL::Exception);
690 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
691 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
692 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
693 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
694 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
695 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
696 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
697 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
698 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
699 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
700 double front() const throw(INTERP_KERNEL::Exception);
701 double back() const throw(INTERP_KERNEL::Exception);
702 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
703 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
704 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
705 double *getPointer() throw(INTERP_KERNEL::Exception);
706 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
707 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
708 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
709 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
710 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
711 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
712 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
713 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
714 double getAverageValue() const throw(INTERP_KERNEL::Exception);
715 double norm2() const throw(INTERP_KERNEL::Exception);
716 double normMax() const throw(INTERP_KERNEL::Exception);
717 double normMin() const throw(INTERP_KERNEL::Exception);
718 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
719 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
720 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
721 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
722 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
723 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
724 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
725 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
726 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
727 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
728 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
729 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
730 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
731 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
732 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
733 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
734 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
735 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
736 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
737 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
738 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
739 void abs() throw(INTERP_KERNEL::Exception);
740 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
741 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
742 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
743 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
744 void applyPow(double val) throw(INTERP_KERNEL::Exception);
745 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
746 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
747 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
748 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
749 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
750 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
751 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
752 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
753 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
754 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
755 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
756 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
757 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
758 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
759 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
760 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
761 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
762 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
763 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
764 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
765 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
766 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
767 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
768 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
769 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
770 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
771 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
772 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
775 DataArrayDouble() throw(INTERP_KERNEL::Exception)
777 return DataArrayDouble::New();
780 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
782 const char *msgBase="MEDCoupling::DataArrayDouble::New : Available API are : \n-DataArrayDouble.New()\n-DataArrayDouble.New([1.,3.,4.])\n-DataArrayDouble.New([1.,3.,4.],3)\n-DataArrayDouble.New([1.,3.,4.,5.],2,2)\n-DataArrayDouble.New([1.,3.,4.,5.,7,8.],3,2)\n-DataArrayDouble.New([(1.,3.),(4.,5.),(7,8.)])\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2)";
783 std::string msg(msgBase);
785 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
788 if(PyList_Check(elt0) || PyTuple_Check(elt0))
792 if(PyInt_Check(nbOfTuples))
794 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
796 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
799 if(PyInt_Check(elt2))
800 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
801 int nbOfCompo=PyInt_AS_LONG(elt2);
803 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
804 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
805 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
806 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
810 throw INTERP_KERNEL::Exception(msg.c_str());
813 {//DataArrayDouble.New([1.,3.,4.],3)
814 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
816 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
817 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
822 throw INTERP_KERNEL::Exception(msg.c_str());
825 {// DataArrayDouble.New([1.,3.,4.])
826 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
827 int tmpp1=-1,tmpp2=-1;
828 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
829 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
833 else if(PyInt_Check(elt0))
835 int nbOfTuples1=PyInt_AS_LONG(elt0);
837 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
842 if(PyInt_Check(nbOfTuples))
843 {//DataArrayDouble.New(5,2)
844 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
846 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
847 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
848 ret->alloc(nbOfTuples1,nbOfCompo);
852 throw INTERP_KERNEL::Exception(msg.c_str());
855 throw INTERP_KERNEL::Exception(msg.c_str());
858 {//DataArrayDouble.New(5)
859 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
860 ret->alloc(nbOfTuples1,1);
865 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
866 {//DataArrayDouble.New(numpyArray)
867 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
871 throw INTERP_KERNEL::Exception(msg.c_str());
872 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
875 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
877 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
880 DataArrayDouble *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
882 MCAuto<DataArrayDouble> ret(self->selectPartDef(pd));
886 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
889 std::vector<double> bb;
891 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
892 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
893 self->pushBackValsSilent(tmp,tmp+nbTuples);
896 std::string __repr__() const throw(INTERP_KERNEL::Exception)
898 std::ostringstream oss;
899 self->reprQuickOverview(oss);
903 std::string __str__() const throw(INTERP_KERNEL::Exception)
905 return self->reprNotTooLong();
908 double __float__() const throw(INTERP_KERNEL::Exception)
910 return self->doubleValue();
913 int __len__() const throw(INTERP_KERNEL::Exception)
915 if(self->isAllocated())
917 return self->getNumberOfTuples();
921 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
925 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
927 return self->iterator();
930 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
932 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 !";
933 if(PyList_Check(li) || PyTuple_Check(li))
937 if(PyInt_Check(nbOfTuples))
939 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
941 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
944 if(PyInt_Check(nbOfComp))
945 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
946 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
948 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
949 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
950 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
953 throw INTERP_KERNEL::Exception(msg);
956 {//DataArrayDouble.setValues([1.,3.,4.],3)
958 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
959 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
963 throw INTERP_KERNEL::Exception(msg);
966 {// DataArrayDouble.setValues([1.,3.,4.])
967 int tmpp1=-1,tmpp2=-1;
968 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
969 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
973 throw INTERP_KERNEL::Exception(msg);
976 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
978 const double *vals=self->getConstPointer();
979 return convertDblArrToPyList(vals,self->getNbOfElems());
983 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
985 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
989 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
992 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
993 PyObject *ret=PyTuple_New(2);
994 PyObject *ret0Py=ret0?Py_True:Py_False;
996 PyTuple_SetItem(ret,0,ret0Py);
997 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1001 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1003 const double *vals=self->getConstPointer();
1004 int nbOfComp=self->getNumberOfComponents();
1005 int nbOfTuples=self->getNumberOfTuples();
1006 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
1009 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1011 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1013 DataArrayDouble *a,*a2;
1014 DataArrayDoubleTuple *aa,*aa2;
1015 std::vector<double> bb,bb2;
1017 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1018 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1019 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1023 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1025 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1027 DataArrayDouble *a,*a2;
1028 DataArrayDoubleTuple *aa,*aa2;
1029 std::vector<double> bb,bb2;
1031 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1033 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1034 return convertDblArrToPyListOfTuple(res,3,3);
1037 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1039 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1041 DataArrayDouble *a,*a2;
1042 DataArrayDoubleTuple *aa,*aa2;
1043 std::vector<double> bb,bb2;
1045 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1046 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1047 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1050 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1053 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1054 if (!SWIG_IsOK(res1))
1057 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1058 if(size!=self->getNumberOfTuples())
1060 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1062 return self->renumber(tmp);
1066 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1068 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1069 da2->checkAllocated();
1070 int size=self->getNumberOfTuples();
1071 if(size!=self->getNumberOfTuples())
1073 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1075 return self->renumber(da2->getConstPointer());
1079 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1082 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1083 if (!SWIG_IsOK(res1))
1086 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1087 if(size!=self->getNumberOfTuples())
1089 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1091 return self->renumberR(tmp);
1095 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1097 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1098 da2->checkAllocated();
1099 int size=self->getNumberOfTuples();
1100 if(size!=self->getNumberOfTuples())
1102 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1104 return self->renumberR(da2->getConstPointer());
1108 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1111 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1112 if (!SWIG_IsOK(res1))
1115 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1116 if(size!=self->getNumberOfTuples())
1118 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1120 return self->renumberAndReduce(tmp,newNbOfTuple);
1124 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1126 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1127 da2->checkAllocated();
1128 int size=self->getNumberOfTuples();
1129 if(size!=self->getNumberOfTuples())
1131 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1133 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1137 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1139 int thisTupleId,otherTupleId;
1140 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1141 PyObject *ret=PyTuple_New(3);
1142 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1143 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1144 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1148 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1151 double r1=self->getMaxValue(tmp);
1152 PyObject *ret=PyTuple_New(2);
1153 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1154 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1158 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1161 double r1=self->getMaxValue2(tmp);
1162 PyObject *ret=PyTuple_New(2);
1163 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1164 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1168 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1171 double r1=self->getMinValue(tmp);
1172 PyObject *ret=PyTuple_New(2);
1173 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1174 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1178 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1181 double r1=self->getMinValue2(tmp);
1182 PyObject *ret=PyTuple_New(2);
1183 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1184 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1188 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1190 int nbOfCompo=self->getNumberOfComponents();
1191 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1192 self->getMinMaxPerComponent(tmp);
1193 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1197 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1199 int sz=self->getNumberOfComponents();
1200 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1201 self->accumulate(tmp);
1202 return convertDblArrToPyList(tmp,sz);
1205 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1208 std::vector<int> val2;
1209 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1210 return self->accumulatePerChunck(bg,bg+sz);
1213 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1215 DataArrayInt *comm, *commIndex;
1216 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1217 PyObject *res = PyList_New(2);
1218 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1219 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1223 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1227 DataArrayDoubleTuple *aa;
1228 std::vector<double> bb;
1230 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1231 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1233 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1234 PyObject *ret=PyTuple_New(2);
1235 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1236 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1240 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1242 std::vector<int> tmp;
1243 convertPyToNewIntArr3(li,tmp);
1244 self->setSelectedComponents(a,tmp);
1247 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1249 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1250 std::size_t sz(retCpp.size());
1251 PyObject *res(PyList_New(sz));
1252 for(std::size_t i=0;i<sz;i++)
1253 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1257 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1259 int sz=self->getNumberOfComponents();
1260 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1261 self->getTuple(tupleId,tmp);
1262 return convertDblArrToPyList(tmp,sz);
1265 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1267 std::vector<const DataArrayDouble *> tmp;
1268 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1269 return DataArrayDouble::Aggregate(tmp);
1272 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1274 std::vector<const DataArrayDouble *> tmp;
1275 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1276 return DataArrayDouble::Meld(tmp);
1279 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1283 DataArrayDoubleTuple *aa;
1284 std::vector<double> bb;
1286 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1287 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1288 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1289 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1290 DataArrayInt *c=0,*cI=0;
1291 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1292 PyObject *ret=PyTuple_New(2);
1293 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1294 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1298 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1300 DataArrayInt *ret1=0;
1301 bool ret0=self->areIncludedInMe(other,prec,ret1);
1302 PyObject *ret=PyTuple_New(2);
1303 PyObject *ret0Py=ret0?Py_True:Py_False;
1305 PyTuple_SetItem(ret,0,ret0Py);
1306 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1310 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1312 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1313 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1314 self->checkAllocated();
1315 int nbOfTuples=self->getNumberOfTuples();
1316 int nbOfComponents=self->getNumberOfComponents();
1318 std::vector<int> vt1,vc1;
1319 std::pair<int, std::pair<int,int> > pt1,pc1;
1320 DataArrayInt *dt1=0,*dc1=0;
1322 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1323 MCAuto<DataArrayDouble> ret;
1327 if(nbOfComponents==1)
1328 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1329 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1331 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1333 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1335 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1337 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1340 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1341 std::vector<int> v2(1,ic1);
1342 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1346 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1347 std::vector<int> v2(1,ic1);
1348 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1352 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1353 std::vector<int> v2(1,ic1);
1354 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1358 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1359 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1363 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1364 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1368 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1369 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1373 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1374 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1378 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1379 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1380 std::vector<int> v2(nbOfComp);
1381 for(int i=0;i<nbOfComp;i++)
1382 v2[i]=pc1.first+i*pc1.second.second;
1383 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1387 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1388 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1389 std::vector<int> v2(nbOfComp);
1390 for(int i=0;i<nbOfComp;i++)
1391 v2[i]=pc1.first+i*pc1.second.second;
1392 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1396 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1397 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1398 std::vector<int> v2(nbOfComp);
1399 for(int i=0;i<nbOfComp;i++)
1400 v2[i]=pc1.first+i*pc1.second.second;
1401 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1405 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1406 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1407 std::vector<int> v2(nbOfComp);
1408 for(int i=0;i<nbOfComp;i++)
1409 v2[i]=pc1.first+i*pc1.second.second;
1410 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1413 throw INTERP_KERNEL::Exception(msg);
1417 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1419 self->checkAllocated();
1420 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1421 int nbOfTuples=self->getNumberOfTuples();
1422 int nbOfComponents=self->getNumberOfComponents();
1425 std::vector<double> v1;
1426 DataArrayDouble *d1=0;
1427 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1429 std::vector<int> vt1,vc1;
1430 std::pair<int, std::pair<int,int> > pt1,pc1;
1431 DataArrayInt *dt1=0,*dc1=0;
1432 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1433 MCAuto<DataArrayDouble> tmp;
1441 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1444 tmp=DataArrayDouble::New();
1445 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1446 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1449 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1452 throw INTERP_KERNEL::Exception(msg);
1461 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1464 tmp=DataArrayDouble::New();
1465 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1466 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1469 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1472 throw INTERP_KERNEL::Exception(msg);
1481 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1484 tmp=DataArrayDouble::New();
1485 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1486 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1489 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1492 throw INTERP_KERNEL::Exception(msg);
1501 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1504 tmp=DataArrayDouble::New();
1505 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1506 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1509 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1512 throw INTERP_KERNEL::Exception(msg);
1521 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1524 tmp=DataArrayDouble::New();
1525 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1526 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1529 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1532 throw INTERP_KERNEL::Exception(msg);
1541 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1544 tmp=DataArrayDouble::New();
1545 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1546 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1549 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1552 throw INTERP_KERNEL::Exception(msg);
1561 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1564 tmp=DataArrayDouble::New();
1565 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1566 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1569 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1572 throw INTERP_KERNEL::Exception(msg);
1581 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1584 tmp=DataArrayDouble::New();
1585 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1586 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1589 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1592 throw INTERP_KERNEL::Exception(msg);
1601 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1604 tmp=DataArrayDouble::New();
1605 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1606 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1609 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1612 throw INTERP_KERNEL::Exception(msg);
1621 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1624 tmp=DataArrayDouble::New();
1625 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1626 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1629 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1632 throw INTERP_KERNEL::Exception(msg);
1641 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1644 tmp=DataArrayDouble::New();
1645 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1646 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1649 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1652 throw INTERP_KERNEL::Exception(msg);
1661 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1664 tmp=DataArrayDouble::New();
1665 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1666 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1669 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1672 throw INTERP_KERNEL::Exception(msg);
1681 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1684 tmp=DataArrayDouble::New();
1685 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1686 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1689 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1692 throw INTERP_KERNEL::Exception(msg);
1701 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1704 tmp=DataArrayDouble::New();
1705 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1706 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1709 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1712 throw INTERP_KERNEL::Exception(msg);
1721 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1724 tmp=DataArrayDouble::New();
1725 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1726 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1729 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1732 throw INTERP_KERNEL::Exception(msg);
1741 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1744 tmp=DataArrayDouble::New();
1745 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1746 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1749 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1752 throw INTERP_KERNEL::Exception(msg);
1757 throw INTERP_KERNEL::Exception(msg);
1762 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1764 return self->negate();
1767 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1769 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1772 DataArrayDoubleTuple *aa;
1773 std::vector<double> bb;
1776 #ifndef WITHOUT_AUTOFIELD
1778 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1780 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1783 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1784 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1786 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1789 throw INTERP_KERNEL::Exception(msg);
1793 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1798 MCAuto<DataArrayDouble> ret=self->deepCopy();
1799 ret->applyLin(1.,val);
1800 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1804 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1808 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1809 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1813 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1814 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1817 throw INTERP_KERNEL::Exception(msg);
1821 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1823 const char msg[]="Unexpected situation in __radd__ !";
1826 DataArrayDoubleTuple *aa;
1827 std::vector<double> bb;
1829 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1834 MCAuto<DataArrayDouble> ret=self->deepCopy();
1835 ret->applyLin(1.,val);
1840 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1841 return DataArrayDouble::Add(self,aaa);
1845 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1846 return DataArrayDouble::Add(self,aaa);
1849 throw INTERP_KERNEL::Exception(msg);
1853 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1855 const char msg[]="Unexpected situation in __iadd__ !";
1858 DataArrayDoubleTuple *aa;
1859 std::vector<double> bb;
1861 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1866 self->applyLin(1.,val);
1867 Py_XINCREF(trueSelf);
1873 Py_XINCREF(trueSelf);
1878 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1879 self->addEqual(aaa);
1880 Py_XINCREF(trueSelf);
1885 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1886 self->addEqual(aaa);
1887 Py_XINCREF(trueSelf);
1891 throw INTERP_KERNEL::Exception(msg);
1895 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1897 const char msg[]="Unexpected situation in __sub__ !";
1900 DataArrayDoubleTuple *aa;
1901 std::vector<double> bb;
1904 #ifndef WITHOUT_AUTOFIELD
1906 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1908 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1911 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1912 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1914 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1917 throw INTERP_KERNEL::Exception(msg);
1921 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1926 MCAuto<DataArrayDouble> ret=self->deepCopy();
1927 ret->applyLin(1.,-val);
1928 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1932 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1936 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1937 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1941 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1942 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1945 throw INTERP_KERNEL::Exception(msg);
1949 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1951 const char msg[]="Unexpected situation in __rsub__ !";
1954 DataArrayDoubleTuple *aa;
1955 std::vector<double> bb;
1957 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1962 MCAuto<DataArrayDouble> ret=self->deepCopy();
1963 ret->applyLin(-1.,val);
1968 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1969 return DataArrayDouble::Substract(aaa,self);
1973 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1974 return DataArrayDouble::Substract(aaa,self);
1977 throw INTERP_KERNEL::Exception(msg);
1981 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1983 const char msg[]="Unexpected situation in __isub__ !";
1986 DataArrayDoubleTuple *aa;
1987 std::vector<double> bb;
1989 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1994 self->applyLin(1,-val);
1995 Py_XINCREF(trueSelf);
2000 self->substractEqual(a);
2001 Py_XINCREF(trueSelf);
2006 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2007 self->substractEqual(aaa);
2008 Py_XINCREF(trueSelf);
2013 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2014 self->substractEqual(aaa);
2015 Py_XINCREF(trueSelf);
2019 throw INTERP_KERNEL::Exception(msg);
2023 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2025 const char msg[]="Unexpected situation in __mul__ !";
2028 DataArrayDoubleTuple *aa;
2029 std::vector<double> bb;
2032 #ifndef WITHOUT_AUTOFIELD
2034 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
2036 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
2039 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
2040 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
2042 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
2045 throw INTERP_KERNEL::Exception(msg);
2049 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2054 MCAuto<DataArrayDouble> ret=self->deepCopy();
2055 ret->applyLin(val,0.);
2056 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2060 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2064 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2065 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2069 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2070 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2073 throw INTERP_KERNEL::Exception(msg);
2077 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2079 const char msg[]="Unexpected situation in __rmul__ !";
2082 DataArrayDoubleTuple *aa;
2083 std::vector<double> bb;
2085 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2090 MCAuto<DataArrayDouble> ret=self->deepCopy();
2091 ret->applyLin(val,0.);
2096 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2097 return DataArrayDouble::Multiply(self,aaa);
2101 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2102 return DataArrayDouble::Multiply(self,aaa);
2105 throw INTERP_KERNEL::Exception(msg);
2109 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2111 const char msg[]="Unexpected situation in __imul__ !";
2114 DataArrayDoubleTuple *aa;
2115 std::vector<double> bb;
2117 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2122 self->applyLin(val,0.);
2123 Py_XINCREF(trueSelf);
2128 self->multiplyEqual(a);
2129 Py_XINCREF(trueSelf);
2134 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2135 self->multiplyEqual(aaa);
2136 Py_XINCREF(trueSelf);
2141 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2142 self->multiplyEqual(aaa);
2143 Py_XINCREF(trueSelf);
2147 throw INTERP_KERNEL::Exception(msg);
2151 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2153 const char msg[]="Unexpected situation in __div__ !";
2156 DataArrayDoubleTuple *aa;
2157 std::vector<double> bb;
2160 #ifndef WITHOUT_AUTOFIELD
2162 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
2164 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
2167 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
2168 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
2170 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
2173 throw INTERP_KERNEL::Exception(msg);
2177 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2183 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2184 MCAuto<DataArrayDouble> ret=self->deepCopy();
2185 ret->applyLin(1/val,0.);
2186 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2190 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2194 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2195 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2199 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2200 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2203 throw INTERP_KERNEL::Exception(msg);
2207 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2209 const char msg[]="Unexpected situation in __rdiv__ !";
2212 DataArrayDoubleTuple *aa;
2213 std::vector<double> bb;
2215 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2220 MCAuto<DataArrayDouble> ret=self->deepCopy();
2226 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2227 return DataArrayDouble::Divide(aaa,self);
2231 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2232 return DataArrayDouble::Divide(aaa,self);
2235 throw INTERP_KERNEL::Exception(msg);
2239 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2241 const char msg[]="Unexpected situation in __idiv__ !";
2244 DataArrayDoubleTuple *aa;
2245 std::vector<double> bb;
2247 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2253 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2254 self->applyLin(1./val,0.);
2255 Py_XINCREF(trueSelf);
2260 self->divideEqual(a);
2261 Py_XINCREF(trueSelf);
2266 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2267 self->divideEqual(aaa);
2268 Py_XINCREF(trueSelf);
2273 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2274 self->divideEqual(aaa);
2275 Py_XINCREF(trueSelf);
2279 throw INTERP_KERNEL::Exception(msg);
2283 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2285 const char msg[]="Unexpected situation in __pow__ !";
2288 DataArrayDoubleTuple *aa;
2289 std::vector<double> bb;
2291 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2296 MCAuto<DataArrayDouble> ret=self->deepCopy();
2302 return DataArrayDouble::Pow(self,a);
2306 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2307 return DataArrayDouble::Pow(self,aaa);
2311 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2312 return DataArrayDouble::Pow(self,aaa);
2315 throw INTERP_KERNEL::Exception(msg);
2319 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2321 const char msg[]="Unexpected situation in __rpow__ !";
2324 DataArrayDoubleTuple *aa;
2325 std::vector<double> bb;
2327 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2332 MCAuto<DataArrayDouble> ret=self->deepCopy();
2333 ret->applyRPow(val);
2338 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2339 return DataArrayDouble::Pow(aaa,self);
2343 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2344 return DataArrayDouble::Pow(aaa,self);
2347 throw INTERP_KERNEL::Exception(msg);
2351 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2353 const char msg[]="Unexpected situation in __ipow__ !";
2356 DataArrayDoubleTuple *aa;
2357 std::vector<double> bb;
2359 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2364 self->applyPow(val);
2365 Py_XINCREF(trueSelf);
2371 Py_XINCREF(trueSelf);
2376 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2377 self->powEqual(aaa);
2378 Py_XINCREF(trueSelf);
2383 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2384 self->powEqual(aaa);
2385 Py_XINCREF(trueSelf);
2389 throw INTERP_KERNEL::Exception(msg);
2393 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2395 DataArrayInt *c=0,*cI=0;
2397 self->computeTupleIdsNearTuples(other,eps,c,cI);
2398 PyObject *ret=PyTuple_New(2);
2399 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2400 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2404 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2406 DataArrayInt *ret1=0;
2407 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2408 PyObject *ret=PyTuple_New(2);
2409 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2410 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2415 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2417 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
2420 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2423 if(!self->isAllocated())
2424 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2425 PyObject *ret(PyTuple_New(1));
2426 PyObject *ret0(PyDict_New());
2427 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2428 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2429 PyObject *tmp1(PyInt_FromLong(0));
2430 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2431 PyTuple_SetItem(ret,0,ret0);
2435 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2441 class DataArrayDoubleTuple;
2443 class DataArrayDoubleIterator
2446 DataArrayDoubleIterator(DataArrayDouble *da);
2447 ~DataArrayDoubleIterator();
2452 DataArrayDoubleTuple *ret=self->nextt();
2454 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2457 PyErr_SetString(PyExc_StopIteration,"No more data.");
2464 class DataArrayDoubleTuple
2467 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2468 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2471 std::string __str__() const throw(INTERP_KERNEL::Exception)
2473 return self->repr();
2476 double __float__() const throw(INTERP_KERNEL::Exception)
2478 return self->doubleValue();
2481 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2483 return self->buildDADouble(1,self->getNumberOfCompo());
2486 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2488 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2489 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2490 Py_XINCREF(trueSelf);
2494 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2496 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2497 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2498 Py_XINCREF(trueSelf);
2502 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2504 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2505 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2506 Py_XINCREF(trueSelf);
2510 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2512 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2513 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2514 Py_XINCREF(trueSelf);
2518 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2520 return PyInt_FromLong(self->getNumberOfCompo());
2523 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2525 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2528 std::vector<int> multiVal;
2529 std::pair<int, std::pair<int,int> > slic;
2530 MEDCoupling::DataArrayInt *daIntTyypp=0;
2531 const double *pt=self->getConstPointer();
2532 int nbc=self->getNumberOfCompo();
2533 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2540 std::ostringstream oss;
2541 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2542 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2546 return PyFloat_FromDouble(pt[singleVal]);
2550 return PyFloat_FromDouble(pt[nbc+singleVal]);
2553 std::ostringstream oss;
2554 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2555 throw INTERP_KERNEL::Exception(oss.str().c_str());
2561 PyObject *t=PyTuple_New(multiVal.size());
2562 for(int j=0;j<(int)multiVal.size();j++)
2564 int cid=multiVal[j];
2567 std::ostringstream oss;
2568 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2569 throw INTERP_KERNEL::Exception(oss.str().c_str());
2571 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2577 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2578 PyObject *t=PyTuple_New(sz);
2579 for(int j=0;j<sz;j++)
2580 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2584 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2588 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2590 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2591 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2594 std::vector<double> multiValV;
2595 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2596 int nbc=self->getNumberOfCompo();
2597 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2599 std::vector<int> multiVal;
2600 std::pair<int, std::pair<int,int> > slic;
2601 MEDCoupling::DataArrayInt *daIntTyypp=0;
2602 double *pt=self->getPointer();
2603 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2610 std::ostringstream oss;
2611 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2612 throw INTERP_KERNEL::Exception(oss.str().c_str());
2618 pt[singleVal]=singleValV;
2623 if(multiValV.size()!=1)
2625 std::ostringstream oss;
2626 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2627 throw INTERP_KERNEL::Exception(oss.str().c_str());
2629 pt[singleVal]=multiValV[0];
2634 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2638 throw INTERP_KERNEL::Exception(msg);
2647 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2651 std::ostringstream oss;
2652 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2653 throw INTERP_KERNEL::Exception(oss.str().c_str());
2661 if(multiVal.size()!=multiValV.size())
2663 std::ostringstream oss;
2664 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2665 throw INTERP_KERNEL::Exception(oss.str().c_str());
2667 for(int i=0;i<(int)multiVal.size();i++)
2669 int pos=multiVal[i];
2672 std::ostringstream oss;
2673 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2674 throw INTERP_KERNEL::Exception(oss.str().c_str());
2676 pt[multiVal[i]]=multiValV[i];
2682 const double *ptV=daIntTyyppV->getConstPointer();
2683 if(nbc>daIntTyyppV->getNumberOfCompo())
2685 std::ostringstream oss;
2686 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2687 throw INTERP_KERNEL::Exception(oss.str().c_str());
2689 std::copy(ptV,ptV+nbc,pt);
2693 throw INTERP_KERNEL::Exception(msg);
2698 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2703 for(int j=0;j<sz;j++)
2704 pt[slic.first+j*slic.second.second]=singleValV;
2709 if(sz!=(int)multiValV.size())
2711 std::ostringstream oss;
2712 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2713 throw INTERP_KERNEL::Exception(oss.str().c_str());
2715 for(int j=0;j<sz;j++)
2716 pt[slic.first+j*slic.second.second]=multiValV[j];
2721 const double *ptV=daIntTyyppV->getConstPointer();
2722 if(sz>daIntTyyppV->getNumberOfCompo())
2724 std::ostringstream oss;
2725 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2726 throw INTERP_KERNEL::Exception(oss.str().c_str());
2728 for(int j=0;j<sz;j++)
2729 pt[slic.first+j*slic.second.second]=ptV[j];
2733 throw INTERP_KERNEL::Exception(msg);
2737 throw INTERP_KERNEL::Exception(msg);
2743 class DataArrayIntIterator;
2745 class DataArrayInt : public DataArray
2748 static DataArrayInt *New();
2749 int intValue() const throw(INTERP_KERNEL::Exception);
2750 int getHashCode() const throw(INTERP_KERNEL::Exception);
2751 bool empty() const throw(INTERP_KERNEL::Exception);
2752 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2753 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2754 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2755 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2756 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2757 int popBackSilent() throw(INTERP_KERNEL::Exception);
2758 void pack() const throw(INTERP_KERNEL::Exception);
2759 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2760 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2761 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2762 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2763 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2764 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2765 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2766 void reverse() throw(INTERP_KERNEL::Exception);
2767 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2768 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2769 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2770 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2771 void fillWithZero() throw(INTERP_KERNEL::Exception);
2772 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2773 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2774 std::string repr() const throw(INTERP_KERNEL::Exception);
2775 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2776 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2777 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2778 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2779 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2780 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2781 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2782 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2783 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2784 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2785 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2786 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2787 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2788 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2789 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2790 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2791 void transpose() throw(INTERP_KERNEL::Exception);
2792 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2793 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2794 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2795 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2796 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2797 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2798 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2799 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2800 int front() const throw(INTERP_KERNEL::Exception);
2801 int back() const throw(INTERP_KERNEL::Exception);
2802 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2803 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2804 int *getPointer() throw(INTERP_KERNEL::Exception);
2805 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2806 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2807 const int *begin() const throw(INTERP_KERNEL::Exception);
2808 const int *end() const throw(INTERP_KERNEL::Exception);
2809 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2810 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2811 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2812 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2813 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2814 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2815 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2816 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2817 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2818 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2819 int count(int value) const throw(INTERP_KERNEL::Exception);
2820 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2821 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2822 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2823 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2824 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2825 void abs() throw(INTERP_KERNEL::Exception);
2826 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2827 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2828 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2829 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2830 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2831 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2832 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2833 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2834 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2835 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2836 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2837 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2838 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2839 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2840 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2841 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2842 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2843 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2844 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2845 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2846 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2847 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2848 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2849 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2850 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2851 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2852 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2853 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2854 void computeOffsets() throw(INTERP_KERNEL::Exception);
2855 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2856 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2857 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2858 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2859 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2860 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2861 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2862 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2863 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2864 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2865 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2866 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2867 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2868 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2869 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2870 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2871 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2872 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2873 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2875 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2878 DataArrayInt() throw(INTERP_KERNEL::Exception)
2880 return DataArrayInt::New();
2883 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2885 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)";
2886 std::string msg(msgBase);
2888 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2891 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2895 if(PyInt_Check(nbOfTuples))
2897 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2899 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2902 if(PyInt_Check(nbOfComp))
2903 {//DataArrayInt.New([1,3,4,5],2,2)
2904 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2906 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2907 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2908 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2909 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2913 throw INTERP_KERNEL::Exception(msg.c_str());
2916 {//DataArrayInt.New([1,3,4],3)
2917 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2919 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2920 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2925 throw INTERP_KERNEL::Exception(msg.c_str());
2928 {// DataArrayInt.New([1,3,4])
2929 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2930 int tmpp1=-1,tmpp2=-1;
2931 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2932 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2936 else if(PyInt_Check(elt0))
2938 int nbOfTuples1=PyInt_AS_LONG(elt0);
2940 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2945 if(PyInt_Check(nbOfTuples))
2946 {//DataArrayInt.New(5,2)
2947 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2949 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2950 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2951 ret->alloc(nbOfTuples1,nbOfCompo);
2955 throw INTERP_KERNEL::Exception(msg.c_str());
2958 throw INTERP_KERNEL::Exception(msg.c_str());
2961 {//DataArrayInt.New(5)
2962 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2963 ret->alloc(nbOfTuples1,1);
2968 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2969 {//DataArrayInt.New(numpyArray)
2970 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2974 throw INTERP_KERNEL::Exception(msg.c_str());
2975 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2978 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2980 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2983 std::string __str__() const throw(INTERP_KERNEL::Exception)
2985 return self->reprNotTooLong();
2988 int __len__() const throw(INTERP_KERNEL::Exception)
2990 if(self->isAllocated())
2992 return self->getNumberOfTuples();
2996 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
3000 int __int__() const throw(INTERP_KERNEL::Exception)
3002 return self->intValue();
3005 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
3007 return self->iterator();
3010 DataArrayInt *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
3012 MCAuto<DataArrayInt> ret(self->selectPartDef(pd));
3016 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3018 int sz=self->getNumberOfComponents();
3019 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3020 self->accumulate(tmp);
3021 return convertIntArrToPyList(tmp,sz);
3024 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
3027 std::vector<int> val2;
3028 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
3029 return self->accumulatePerChunck(bg,bg+sz);
3032 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
3035 std::vector<int> val2;
3036 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
3037 return self->findIdsEqualTuple(bg,bg+sz);
3040 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
3042 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
3043 PyObject *ret=PyList_New(slcs.size());
3044 for(std::size_t i=0;i<slcs.size();i++)
3045 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
3049 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
3051 if(!PySlice_Check(slic))
3052 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
3053 Py_ssize_t strt=2,stp=2,step=2;
3054 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
3055 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
3056 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
3057 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 !");
3058 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
3061 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
3064 self->getMinMaxValues(a,b);
3065 PyObject *ret=PyTuple_New(2);
3066 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
3067 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
3071 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
3073 int newNbOfTuples=-1;
3074 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
3075 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
3076 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
3077 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
3078 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
3079 PyObject *ret=PyTuple_New(2);
3080 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3081 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
3085 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
3087 MCAuto<DataArrayInt> ret(DataArrayInt::New());
3088 int szArr,sw,iTypppArr;
3089 std::vector<int> stdvecTyyppArr;
3090 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
3091 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
3092 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
3096 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3098 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 !";
3099 if(PyList_Check(li) || PyTuple_Check(li))
3101 if(nbOfTuples && nbOfTuples != Py_None)
3103 if(PyInt_Check(nbOfTuples))
3105 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
3107 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
3108 if(nbOfComp && nbOfComp != Py_None)
3110 if(PyInt_Check(nbOfComp))
3111 {//DataArrayInt.setValues([1,3,4,5],2,2)
3112 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
3114 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
3115 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
3116 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
3119 throw INTERP_KERNEL::Exception(msg);
3122 {//DataArrayInt.setValues([1,3,4],3)
3124 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
3125 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
3129 throw INTERP_KERNEL::Exception(msg);
3132 {// DataArrayInt.setValues([1,3,4])
3133 int tmpp1=-1,tmpp2=-1;
3134 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
3135 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
3139 throw INTERP_KERNEL::Exception(msg);
3142 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
3144 const int *vals=self->getConstPointer();
3145 return convertIntArrToPyList(vals,self->getNbOfElems());
3149 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
3151 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
3155 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
3158 bool ret0=self->isEqualIfNotWhy(other,ret1);
3159 PyObject *ret=PyTuple_New(2);
3160 PyObject *ret0Py=ret0?Py_True:Py_False;
3162 PyTuple_SetItem(ret,0,ret0Py);
3163 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3167 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
3169 const int *vals=self->getConstPointer();
3170 int nbOfComp=self->getNumberOfComponents();
3171 int nbOfTuples=self->getNumberOfTuples();
3172 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
3175 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
3177 std::vector<const DataArrayInt *> groups;
3178 std::vector< std::vector<int> > fidsOfGroups;
3179 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
3180 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3181 PyObject *ret = PyList_New(2);
3182 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3183 int sz=fidsOfGroups.size();
3184 PyObject *ret1 = PyList_New(sz);
3185 for(int i=0;i<sz;i++)
3186 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3187 PyList_SetItem(ret,1,ret1);
3191 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3194 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3195 if (!SWIG_IsOK(res1))
3198 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3199 self->transformWithIndArr(tmp,tmp+size);
3203 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3204 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3208 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3212 std::vector<int> multiVal;
3213 std::pair<int, std::pair<int,int> > slic;
3214 MEDCoupling::DataArrayInt *daIntTyypp=0;
3215 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3219 return self->findIdsEqualList(&singleVal,&singleVal+1);
3221 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3223 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3225 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3229 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3233 std::vector<int> multiVal;
3234 std::pair<int, std::pair<int,int> > slic;
3235 MEDCoupling::DataArrayInt *daIntTyypp=0;
3236 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3240 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
3242 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3244 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3246 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3250 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3252 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3254 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3255 if (!SWIG_IsOK(res1))
3258 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3259 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3263 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3265 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3266 da2->checkAllocated();
3267 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
3269 PyObject *ret = PyList_New(3);
3270 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3271 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3272 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3276 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3279 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3280 if (!SWIG_IsOK(res1))
3283 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3284 return self->transformWithIndArrR(tmp,tmp+size);
3288 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3289 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3293 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3296 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3297 if (!SWIG_IsOK(res1))
3300 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3301 if(size!=self->getNumberOfTuples())
3303 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3305 return self->renumberAndReduce(tmp,newNbOfTuple);
3309 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3311 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3312 da2->checkAllocated();
3313 int size=self->getNumberOfTuples();
3314 if(size!=self->getNumberOfTuples())
3316 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3318 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3322 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3325 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3326 if (!SWIG_IsOK(res1))
3329 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3330 if(size!=self->getNumberOfTuples())
3332 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3334 return self->renumber(tmp);
3338 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3340 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3341 da2->checkAllocated();
3342 int size=self->getNumberOfTuples();
3343 if(size!=self->getNumberOfTuples())
3345 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3347 return self->renumber(da2->getConstPointer());
3351 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3354 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3355 if (!SWIG_IsOK(res1))
3358 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3359 if(size!=self->getNumberOfTuples())
3361 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3363 return self->renumberR(tmp);
3367 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3369 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3370 da2->checkAllocated();
3371 int size=self->getNumberOfTuples();
3372 if(size!=self->getNumberOfTuples())
3374 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3376 return self->renumberR(da2->getConstPointer());
3380 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3382 std::vector<int> tmp;
3383 convertPyToNewIntArr3(li,tmp);
3384 self->setSelectedComponents(a,tmp);
3387 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
3389 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
3390 std::size_t sz(retCpp.size());
3391 PyObject *res(PyList_New(sz));
3392 for(std::size_t i=0;i<sz;i++)
3393 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3397 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3399 int sz=self->getNumberOfComponents();
3400 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3401 self->getTuple(tupleId,tmp);
3402 return convertIntArrToPyList(tmp,sz);
3405 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3407 DataArrayInt *arr=0;
3408 DataArrayInt *arrI=0;
3409 self->changeSurjectiveFormat(targetNb,arr,arrI);
3410 PyObject *res = PyList_New(2);
3411 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3412 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3416 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3418 std::vector<const DataArrayInt *> tmp;
3419 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3420 return DataArrayInt::Meld(tmp);
3423 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3425 std::vector<const DataArrayInt *> tmp;
3426 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3427 return DataArrayInt::Aggregate(tmp);
3430 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3432 std::vector<const DataArrayInt *> tmp;
3433 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3434 return DataArrayInt::AggregateIndexes(tmp);
3437 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3439 std::vector<const DataArrayInt *> tmp;
3440 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3441 return DataArrayInt::BuildUnion(tmp);
3444 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3446 std::vector<const DataArrayInt *> tmp;
3447 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3448 return DataArrayInt::BuildIntersection(tmp);
3451 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3454 int r1=self->getMaxValue(tmp);
3455 PyObject *ret=PyTuple_New(2);
3456 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3457 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3461 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3464 int r1=self->getMinValue(tmp);
3465 PyObject *ret=PyTuple_New(2);
3466 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3467 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3471 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3473 int nbOfCompo=self->getNumberOfComponents();
3478 if(PyInt_Check(obj))
3480 int val=(int)PyInt_AS_LONG(obj);
3481 return self->findIdFirstEqual(val);
3484 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3488 std::vector<int> arr;
3489 convertPyToNewIntArr3(obj,arr);
3490 return self->findIdFirstEqualTuple(arr);
3495 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3497 int nbOfCompo=self->getNumberOfComponents();
3504 if(PyInt_Check(obj))
3506 int val=(int)PyInt_AS_LONG(obj);
3507 return self->presenceOfValue(val);
3510 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3514 std::vector<int> arr;
3515 convertPyToNewIntArr3(obj,arr);
3516 return self->presenceOfTuple(arr);
3521 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3523 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3524 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3525 self->checkAllocated();
3526 int nbOfTuples=self->getNumberOfTuples();
3527 int nbOfComponents=self->getNumberOfComponents();
3529 std::vector<int> vt1,vc1;
3530 std::pair<int, std::pair<int,int> > pt1,pc1;
3531 DataArrayInt *dt1=0,*dc1=0;
3533 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3534 MCAuto<DataArrayInt> ret;
3539 if(nbOfComponents==1)
3540 return PyInt_FromLong(self->getIJSafe(it1,0));
3541 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3544 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3546 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3548 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3550 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3553 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3554 std::vector<int> v2(1,ic1);
3555 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3559 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3560 std::vector<int> v2(1,ic1);
3561 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3565 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3566 std::vector<int> v2(1,ic1);
3567 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3571 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3572 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3576 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3577 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3581 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3582 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3586 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3587 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3591 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3592 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3593 std::vector<int> v2(nbOfComp);
3594 for(int i=0;i<nbOfComp;i++)
3595 v2[i]=pc1.first+i*pc1.second.second;
3596 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3600 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3601 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3602 std::vector<int> v2(nbOfComp);
3603 for(int i=0;i<nbOfComp;i++)
3604 v2[i]=pc1.first+i*pc1.second.second;
3605 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3609 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3610 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3611 std::vector<int> v2(nbOfComp);
3612 for(int i=0;i<nbOfComp;i++)
3613 v2[i]=pc1.first+i*pc1.second.second;
3614 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3618 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3619 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3620 std::vector<int> v2(nbOfComp);
3621 for(int i=0;i<nbOfComp;i++)
3622 v2[i]=pc1.first+i*pc1.second.second;
3623 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3626 throw INTERP_KERNEL::Exception(msg);
3630 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3632 self->checkAllocated();
3633 const char msg[]="Unexpected situation in __setitem__ !";
3634 int nbOfTuples=self->getNumberOfTuples();
3635 int nbOfComponents=self->getNumberOfComponents();
3638 std::vector<int> v1;
3640 DataArrayIntTuple *dd1=0;
3641 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3643 std::vector<int> vt1,vc1;
3644 std::pair<int, std::pair<int,int> > pt1,pc1;
3645 DataArrayInt *dt1=0,*dc1=0;
3646 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3647 MCAuto<DataArrayInt> tmp;
3655 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3658 tmp=DataArrayInt::New();
3659 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3660 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3663 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3666 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3667 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3670 throw INTERP_KERNEL::Exception(msg);
3679 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3682 tmp=DataArrayInt::New();
3683 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3684 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3687 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3690 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3691 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3694 throw INTERP_KERNEL::Exception(msg);
3703 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3706 tmp=DataArrayInt::New();
3707 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3708 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3711 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3714 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3715 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3718 throw INTERP_KERNEL::Exception(msg);
3727 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3730 tmp=DataArrayInt::New();
3731 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3732 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3735 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3738 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3739 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3742 throw INTERP_KERNEL::Exception(msg);
3751 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3754 tmp=DataArrayInt::New();
3755 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3756 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3759 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3762 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3763 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3766 throw INTERP_KERNEL::Exception(msg);
3775 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3778 tmp=DataArrayInt::New();
3779 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3780 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3783 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3786 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3787 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3790 throw INTERP_KERNEL::Exception(msg);
3799 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3802 tmp=DataArrayInt::New();
3803 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3804 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3807 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3810 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3811 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3814 throw INTERP_KERNEL::Exception(msg);
3823 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3826 tmp=DataArrayInt::New();
3827 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3828 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3831 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3834 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3835 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3838 throw INTERP_KERNEL::Exception(msg);
3847 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3850 tmp=DataArrayInt::New();
3851 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3852 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3855 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3858 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3859 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3862 throw INTERP_KERNEL::Exception(msg);
3871 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3874 tmp=DataArrayInt::New();
3875 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3876 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3879 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3882 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3883 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3886 throw INTERP_KERNEL::Exception(msg);
3895 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3898 tmp=DataArrayInt::New();
3899 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3900 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3903 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3906 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3907 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3910 throw INTERP_KERNEL::Exception(msg);
3919 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3922 tmp=DataArrayInt::New();
3923 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3924 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3927 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3930 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3931 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3934 throw INTERP_KERNEL::Exception(msg);
3943 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3946 tmp=DataArrayInt::New();
3947 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3948 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3951 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3954 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3955 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3958 throw INTERP_KERNEL::Exception(msg);
3967 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3970 tmp=DataArrayInt::New();
3971 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3972 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3975 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3978 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3979 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3982 throw INTERP_KERNEL::Exception(msg);
3991 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3994 tmp=DataArrayInt::New();
3995 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3996 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3999 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
4002 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
4003 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
4006 throw INTERP_KERNEL::Exception(msg);
4015 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
4018 tmp=DataArrayInt::New();
4019 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4020 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
4023 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
4026 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
4027 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
4030 throw INTERP_KERNEL::Exception(msg);
4035 throw INTERP_KERNEL::Exception(msg);
4040 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
4042 return self->negate();
4045 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4047 const char msg[]="Unexpected situation in __add__ !";
4050 std::vector<int> aa;
4051 DataArrayIntTuple *aaa;
4053 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4058 MCAuto<DataArrayInt> ret=self->deepCopy();
4059 ret->applyLin(1,val);
4064 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4065 return DataArrayInt::Add(self,aaaa);
4069 return DataArrayInt::Add(self,a);
4073 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4074 return DataArrayInt::Add(self,aaaa);
4077 throw INTERP_KERNEL::Exception(msg);
4081 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4083 const char msg[]="Unexpected situation in __radd__ !";
4086 std::vector<int> aa;
4087 DataArrayIntTuple *aaa;
4089 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4094 MCAuto<DataArrayInt> ret=self->deepCopy();
4095 ret->applyLin(1,val);
4100 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4101 return DataArrayInt::Add(self,aaaa);
4105 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4106 return DataArrayInt::Add(self,aaaa);
4109 throw INTERP_KERNEL::Exception(msg);
4113 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4115 const char msg[]="Unexpected situation in __iadd__ !";
4118 std::vector<int> aa;
4119 DataArrayIntTuple *aaa;
4121 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4126 self->applyLin(1,val);
4127 Py_XINCREF(trueSelf);
4132 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4134 Py_XINCREF(trueSelf);
4140 Py_XINCREF(trueSelf);
4145 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4146 self->addEqual(aaaa);
4147 Py_XINCREF(trueSelf);
4151 throw INTERP_KERNEL::Exception(msg);
4155 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4157 const char msg[]="Unexpected situation in __sub__ !";
4160 std::vector<int> aa;
4161 DataArrayIntTuple *aaa;
4163 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4168 MCAuto<DataArrayInt> ret=self->deepCopy();
4169 ret->applyLin(1,-val);
4174 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4175 return DataArrayInt::Substract(self,aaaa);
4179 return DataArrayInt::Substract(self,a);
4183 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4184 return DataArrayInt::Substract(self,aaaa);
4187 throw INTERP_KERNEL::Exception(msg);
4191 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4193 const char msg[]="Unexpected situation in __rsub__ !";
4196 std::vector<int> aa;
4197 DataArrayIntTuple *aaa;
4199 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4204 MCAuto<DataArrayInt> ret=self->deepCopy();
4205 ret->applyLin(-1,val);
4210 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4211 return DataArrayInt::Substract(aaaa,self);
4215 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4216 return DataArrayInt::Substract(aaaa,self);
4219 throw INTERP_KERNEL::Exception(msg);
4223 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4225 const char msg[]="Unexpected situation in __isub__ !";
4228 std::vector<int> aa;
4229 DataArrayIntTuple *aaa;
4231 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4236 self->applyLin(1,-val);
4237 Py_XINCREF(trueSelf);
4242 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4243 self->substractEqual(bb);
4244 Py_XINCREF(trueSelf);
4249 self->substractEqual(a);
4250 Py_XINCREF(trueSelf);
4255 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4256 self->substractEqual(aaaa);
4257 Py_XINCREF(trueSelf);
4261 throw INTERP_KERNEL::Exception(msg);
4265 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4267 const char msg[]="Unexpected situation in __mul__ !";
4270 std::vector<int> aa;
4271 DataArrayIntTuple *aaa;
4273 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4278 MCAuto<DataArrayInt> ret=self->deepCopy();
4279 ret->applyLin(val,0);
4284 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4285 return DataArrayInt::Multiply(self,aaaa);
4289 return DataArrayInt::Multiply(self,a);
4293 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4294 return DataArrayInt::Multiply(self,aaaa);
4297 throw INTERP_KERNEL::Exception(msg);
4301 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4303 const char msg[]="Unexpected situation in __rmul__ !";
4306 std::vector<int> aa;
4307 DataArrayIntTuple *aaa;
4309 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4314 MCAuto<DataArrayInt> ret=self->deepCopy();
4315 ret->applyLin(val,0);
4320 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4321 return DataArrayInt::Multiply(self,aaaa);
4325 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4326 return DataArrayInt::Multiply(self,aaaa);
4329 throw INTERP_KERNEL::Exception(msg);
4333 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4335 const char msg[]="Unexpected situation in __imul__ !";
4338 std::vector<int> aa;
4339 DataArrayIntTuple *aaa;
4341 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4346 self->applyLin(val,0);
4347 Py_XINCREF(trueSelf);
4352 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4353 self->multiplyEqual(bb);
4354 Py_XINCREF(trueSelf);
4359 self->multiplyEqual(a);
4360 Py_XINCREF(trueSelf);
4365 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4366 self->multiplyEqual(aaaa);
4367 Py_XINCREF(trueSelf);
4371 throw INTERP_KERNEL::Exception(msg);
4375 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4377 const char msg[]="Unexpected situation in __div__ !";
4380 std::vector<int> aa;
4381 DataArrayIntTuple *aaa;
4383 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4388 MCAuto<DataArrayInt> ret=self->deepCopy();
4389 ret->applyDivideBy(val);
4394 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4395 return DataArrayInt::Divide(self,aaaa);
4399 return DataArrayInt::Divide(self,a);
4403 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4404 return DataArrayInt::Divide(self,aaaa);
4407 throw INTERP_KERNEL::Exception(msg);
4411 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4413 const char msg[]="Unexpected situation in __rdiv__ !";
4416 std::vector<int> aa;
4417 DataArrayIntTuple *aaa;
4419 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4424 MCAuto<DataArrayInt> ret=self->deepCopy();
4430 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4431 return DataArrayInt::Divide(aaaa,self);
4435 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4436 return DataArrayInt::Divide(aaaa,self);
4439 throw INTERP_KERNEL::Exception(msg);
4443 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4445 const char msg[]="Unexpected situation in __idiv__ !";
4448 std::vector<int> aa;
4449 DataArrayIntTuple *aaa;
4451 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4456 self->applyDivideBy(val);
4457 Py_XINCREF(trueSelf);
4462 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4463 self->divideEqual(bb);
4464 Py_XINCREF(trueSelf);
4469 self->divideEqual(a);
4470 Py_XINCREF(trueSelf);
4475 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4476 self->divideEqual(aaaa);
4477 Py_XINCREF(trueSelf);
4481 throw INTERP_KERNEL::Exception(msg);
4485 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4487 const char msg[]="Unexpected situation in __mod__ !";
4490 std::vector<int> aa;
4491 DataArrayIntTuple *aaa;
4493 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4498 MCAuto<DataArrayInt> ret=self->deepCopy();
4499 ret->applyModulus(val);
4504 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4505 return DataArrayInt::Modulus(self,aaaa);
4509 return DataArrayInt::Modulus(self,a);
4513 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4514 return DataArrayInt::Modulus(self,aaaa);
4517 throw INTERP_KERNEL::Exception(msg);
4521 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4523 const char msg[]="Unexpected situation in __rmod__ !";
4526 std::vector<int> aa;
4527 DataArrayIntTuple *aaa;
4529 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4534 MCAuto<DataArrayInt> ret=self->deepCopy();
4535 ret->applyRModulus(val);
4540 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4541 return DataArrayInt::Modulus(aaaa,self);
4545 return DataArrayInt::Modulus(a,self);
4549 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4550 return DataArrayInt::Modulus(aaaa,self);
4553 throw INTERP_KERNEL::Exception(msg);
4557 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4559 const char msg[]="Unexpected situation in __imod__ !";
4562 std::vector<int> aa;
4563 DataArrayIntTuple *aaa;
4565 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4570 self->applyModulus(val);
4571 Py_XINCREF(trueSelf);
4576 self->modulusEqual(a);
4577 Py_XINCREF(trueSelf);
4582 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4583 self->modulusEqual(aaaa);
4584 Py_XINCREF(trueSelf);
4588 throw INTERP_KERNEL::Exception(msg);
4592 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4594 const char msg[]="Unexpected situation in __pow__ !";
4597 std::vector<int> aa;
4598 DataArrayIntTuple *aaa;
4600 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4605 MCAuto<DataArrayInt> ret=self->deepCopy();
4611 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4612 return DataArrayInt::Pow(self,aaaa);
4616 return DataArrayInt::Pow(self,a);
4620 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4621 return DataArrayInt::Pow(self,aaaa);
4624 throw INTERP_KERNEL::Exception(msg);
4628 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4630 const char msg[]="Unexpected situation in __rpow__ !";
4633 std::vector<int> aa;
4634 DataArrayIntTuple *aaa;
4636 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4641 MCAuto<DataArrayInt> ret=self->deepCopy();
4642 ret->applyRPow(val);
4647 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4648 return DataArrayInt::Pow(aaaa,self);
4652 return DataArrayInt::Pow(a,self);
4656 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4657 return DataArrayInt::Pow(aaaa,self);
4660 throw INTERP_KERNEL::Exception(msg);
4664 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4666 const char msg[]="Unexpected situation in __ipow__ !";
4669 std::vector<int> aa;
4670 DataArrayIntTuple *aaa;
4672 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4677 self->applyPow(val);
4678 Py_XINCREF(trueSelf);
4684 Py_XINCREF(trueSelf);
4689 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4690 self->powEqual(aaaa);
4691 Py_XINCREF(trueSelf);
4695 throw INTERP_KERNEL::Exception(msg);
4699 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4701 std::ostringstream oss;
4702 self->reprQuickOverview(oss);
4706 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4708 int szArr,sw,iTypppArr;
4709 std::vector<int> stdvecTyyppArr;
4710 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4711 self->pushBackValsSilent(tmp,tmp+szArr);
4714 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4716 std::vector<int> ret1;
4717 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4718 std::size_t sz=ret0.size();
4719 PyObject *pyRet=PyTuple_New(2);
4720 PyObject *pyRet0=PyList_New((int)sz);
4721 PyObject *pyRet1=PyList_New((int)sz);
4722 for(std::size_t i=0;i<sz;i++)
4724 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4725 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4727 PyTuple_SetItem(pyRet,0,pyRet0);
4728 PyTuple_SetItem(pyRet,1,pyRet1);
4732 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4734 DataArrayInt *ret0=0,*ret1=0;
4735 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4736 PyObject *pyRet=PyTuple_New(2);
4737 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4738 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4742 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4745 bool ret(self->isRange(a,b,c));
4746 PyObject *pyRet=PyTuple_New(2);
4747 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4749 PyTuple_SetItem(pyRet,0,ret0Py);
4751 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4757 PyTuple_SetItem(pyRet,1,ret1Py);
4762 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4764 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4767 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4770 if(!self->isAllocated())
4771 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4772 PyObject *ret(PyTuple_New(1));
4773 PyObject *ret0(PyDict_New());
4774 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4775 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4776 PyObject *tmp1(PyInt_FromLong(0));
4777 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4778 PyTuple_SetItem(ret,0,ret0);
4782 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4788 class DataArrayIntTuple;
4790 class DataArrayIntIterator
4793 DataArrayIntIterator(DataArrayInt *da);
4794 ~DataArrayIntIterator();
4799 DataArrayIntTuple *ret=self->nextt();
4801 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4804 PyErr_SetString(PyExc_StopIteration,"No more data.");
4811 class DataArrayIntTuple
4814 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4815 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4818 std::string __str__() const throw(INTERP_KERNEL::Exception)
4820 return self->repr();
4823 int __int__() const throw(INTERP_KERNEL::Exception)
4825 return self->intValue();
4828 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4830 return self->buildDAInt(1,self->getNumberOfCompo());
4833 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4835 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4836 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4837 Py_XINCREF(trueSelf);
4841 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4843 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4844 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4845 Py_XINCREF(trueSelf);
4849 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4851 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4852 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4853 Py_XINCREF(trueSelf);
4857 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4859 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4860 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4861 Py_XINCREF(trueSelf);
4865 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4867 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4868 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4869 Py_XINCREF(trueSelf);
4873 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4875 return PyInt_FromLong(self->getNumberOfCompo());
4878 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4880 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4883 std::vector<int> multiVal;
4884 std::pair<int, std::pair<int,int> > slic;
4885 MEDCoupling::DataArrayInt *daIntTyypp=0;
4886 const int *pt=self->getConstPointer();
4887 int nbc=self->getNumberOfCompo();
4888 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4895 std::ostringstream oss;
4896 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4897 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4901 return PyInt_FromLong(pt[singleVal]);
4905 return PyInt_FromLong(pt[nbc+singleVal]);
4908 std::ostringstream oss;
4909 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4910 throw INTERP_KERNEL::Exception(oss.str().c_str());
4916 PyObject *t=PyTuple_New(multiVal.size());
4917 for(int j=0;j<(int)multiVal.size();j++)
4919 int cid=multiVal[j];
4922 std::ostringstream oss;
4923 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4924 throw INTERP_KERNEL::Exception(oss.str().c_str());
4926 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4932 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4933 PyObject *t=PyTuple_New(sz);
4934 for(int j=0;j<sz;j++)
4935 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4939 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4943 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4945 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4946 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4949 std::vector<int> multiValV;
4950 std::pair<int, std::pair<int,int> > slicV;
4951 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4952 int nbc=self->getNumberOfCompo();
4953 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4955 std::vector<int> multiVal;
4956 std::pair<int, std::pair<int,int> > slic;
4957 MEDCoupling::DataArrayInt *daIntTyypp=0;
4958 int *pt=self->getPointer();
4959 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4966 std::ostringstream oss;
4967 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4968 throw INTERP_KERNEL::Exception(oss.str().c_str());
4974 pt[singleVal]=singleValV;
4979 if(multiValV.size()!=1)
4981 std::ostringstream oss;
4982 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4983 throw INTERP_KERNEL::Exception(oss.str().c_str());
4985 pt[singleVal]=multiValV[0];
4990 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4994 throw INTERP_KERNEL::Exception(msg);
5003 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
5007 std::ostringstream oss;
5008 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
5009 throw INTERP_KERNEL::Exception(oss.str().c_str());
5017 if(multiVal.size()!=multiValV.size())
5019 std::ostringstream oss;
5020 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
5021 throw INTERP_KERNEL::Exception(oss.str().c_str());
5023 for(int i=0;i<(int)multiVal.size();i++)
5025 int pos=multiVal[i];
5028 std::ostringstream oss;
5029 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
5030 throw INTERP_KERNEL::Exception(oss.str().c_str());
5032 pt[multiVal[i]]=multiValV[i];
5038 const int *ptV=daIntTyyppV->getConstPointer();
5039 if(nbc>daIntTyyppV->getNumberOfCompo())
5041 std::ostringstream oss;
5042 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
5043 throw INTERP_KERNEL::Exception(oss.str().c_str());
5045 std::copy(ptV,ptV+nbc,pt);
5049 throw INTERP_KERNEL::Exception(msg);
5054 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
5059 for(int j=0;j<sz;j++)
5060 pt[slic.first+j*slic.second.second]=singleValV;
5065 if(sz!=(int)multiValV.size())
5067 std::ostringstream oss;
5068 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
5069 throw INTERP_KERNEL::Exception(oss.str().c_str());
5071 for(int j=0;j<sz;j++)
5072 pt[slic.first+j*slic.second.second]=multiValV[j];
5077 const int *ptV=daIntTyyppV->getConstPointer();
5078 if(sz>daIntTyyppV->getNumberOfCompo())
5080 std::ostringstream oss;
5081 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
5082 throw INTERP_KERNEL::Exception(oss.str().c_str());
5084 for(int j=0;j<sz;j++)
5085 pt[slic.first+j*slic.second.second]=ptV[j];
5089 throw INTERP_KERNEL::Exception(msg);
5093 throw INTERP_KERNEL::Exception(msg);
5099 class DataArrayChar : public DataArray
5102 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
5103 int getHashCode() const throw(INTERP_KERNEL::Exception);
5104 bool empty() const throw(INTERP_KERNEL::Exception);
5105 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
5106 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
5107 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
5108 char popBackSilent() throw(INTERP_KERNEL::Exception);
5109 void pack() const throw(INTERP_KERNEL::Exception);
5110 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
5111 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
5112 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
5113 void reverse() throw(INTERP_KERNEL::Exception);
5114 void fillWithZero() throw(INTERP_KERNEL::Exception);
5115 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
5116 std::string repr() const throw(INTERP_KERNEL::Exception);
5117 std::string reprZip() const throw(INTERP_KERNEL::Exception);
5118 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
5119 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
5120 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
5121 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
5122 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
5123 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
5124 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
5125 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
5126 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
5127 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
5128 char front() const throw(INTERP_KERNEL::Exception);
5129 char back() const throw(INTERP_KERNEL::Exception);
5130 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
5131 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
5132 char *getPointer() throw(INTERP_KERNEL::Exception);
5133 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
5134 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
5135 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
5136 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
5137 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
5138 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
5139 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
5140 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
5141 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
5142 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
5143 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
5146 int __len__() const throw(INTERP_KERNEL::Exception)
5148 if(self->isAllocated())
5150 return self->getNumberOfTuples();
5154 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
5158 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
5161 bool ret0=self->isEqualIfNotWhy(other,ret1);
5162 PyObject *ret=PyTuple_New(2);
5163 PyObject *ret0Py=ret0?Py_True:Py_False;
5165 PyTuple_SetItem(ret,0,ret0Py);
5166 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5170 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5173 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5174 if (!SWIG_IsOK(res1))
5177 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5178 if(size!=self->getNumberOfTuples())
5180 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5182 return self->renumber(tmp);
5186 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5188 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5189 da2->checkAllocated();
5190 int size=self->getNumberOfTuples();
5191 if(size!=self->getNumberOfTuples())
5193 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5195 return self->renumber(da2->getConstPointer());
5199 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5202 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5203 if (!SWIG_IsOK(res1))
5206 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5207 if(size!=self->getNumberOfTuples())
5209 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5211 return self->renumberR(tmp);
5215 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5217 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5218 da2->checkAllocated();
5219 int size=self->getNumberOfTuples();
5220 if(size!=self->getNumberOfTuples())
5222 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5224 return self->renumberR(da2->getConstPointer());
5228 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5231 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5232 if (!SWIG_IsOK(res1))
5235 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5236 if(size!=self->getNumberOfTuples())
5238 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5240 return self->renumberAndReduce(tmp,newNbOfTuple);
5244 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5246 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5247 da2->checkAllocated();
5248 int size=self->getNumberOfTuples();
5249 if(size!=self->getNumberOfTuples())
5251 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5253 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5257 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5259 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5260 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5261 return DataArrayChar::Aggregate(tmp);
5264 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5266 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5267 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5268 return DataArrayChar::Meld(tmp);
5273 class DataArrayByteIterator;
5275 class DataArrayByte : public DataArrayChar
5278 static DataArrayByte *New();
5279 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5280 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5281 char byteValue() const throw(INTERP_KERNEL::Exception);
5284 DataArrayByte() throw(INTERP_KERNEL::Exception)
5286 return DataArrayByte::New();
5289 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5291 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) !";
5292 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5296 if(PyInt_Check(nbOfTuples))
5298 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5300 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5303 if(PyInt_Check(nbOfComp))
5304 {//DataArrayByte.New([1,3,4,5],2,2)
5305 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5307 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5308 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5309 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5310 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5314 throw INTERP_KERNEL::Exception(msg);
5317 {//DataArrayByte.New([1,3,4],3)
5318 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5320 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5321 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5326 throw INTERP_KERNEL::Exception(msg);
5329 {// DataArrayByte.New([1,3,4])
5330 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5331 int tmpp1=-1,tmpp2=-1;
5332 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5333 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5337 else if(PyInt_Check(elt0))
5339 int nbOfTuples1=PyInt_AS_LONG(elt0);
5341 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5346 if(PyInt_Check(nbOfTuples))
5347 {//DataArrayByte.New(5,2)
5348 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5350 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5351 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5352 ret->alloc(nbOfTuples1,nbOfCompo);
5356 throw INTERP_KERNEL::Exception(msg);
5359 throw INTERP_KERNEL::Exception(msg);
5362 {//DataArrayByte.New(5)
5363 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5364 ret->alloc(nbOfTuples1,1);
5369 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
5370 {//DataArrayDouble.New(numpyArray)
5371 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
5375 throw INTERP_KERNEL::Exception(msg);
5378 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5380 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5383 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5385 std::ostringstream oss;
5386 self->reprQuickOverview(oss);
5390 int __int__() const throw(INTERP_KERNEL::Exception)
5392 return (int) self->byteValue();
5395 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5397 return self->iterator();
5400 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5402 return (int)self->getIJ(tupleId,compoId);
5405 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5407 return (int)self->getIJSafe(tupleId,compoId);
5410 std::string __str__() const throw(INTERP_KERNEL::Exception)
5412 return self->repr();
5415 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5417 const char *vals=self->getConstPointer();
5418 int nbOfComp=self->getNumberOfComponents();
5419 int nbOfTuples=self->getNumberOfTuples();
5420 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5423 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5426 int ival=-1; std::vector<int> ivval;
5427 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5428 std::vector<char> vals(sz);
5429 std::copy(pt,pt+sz,vals.begin());
5430 return self->presenceOfTuple(vals);
5433 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5436 int ival=-1; std::vector<int> ivval;
5437 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5438 std::vector<char> vals2(sz);
5439 std::copy(pt,pt+sz,vals2.begin());
5440 return self->presenceOfValue(vals2);
5443 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5446 int ival=-1; std::vector<int> ivval;
5447 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5448 std::vector<char> vals2(sz);
5449 std::copy(pt,pt+sz,vals2.begin());
5450 return self->findIdFirstEqual(vals2);
5453 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5456 int ival=-1; std::vector<int> ivval;
5457 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5458 std::vector<char> vals(sz);
5459 std::copy(pt,pt+sz,vals.begin());
5460 return self->findIdFirstEqualTuple(vals);
5463 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5466 int ival=-1; std::vector<int> ivval;
5467 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5468 std::vector<char> vals(sz);
5469 std::copy(pt,pt+sz,vals.begin());
5470 return self->findIdSequence(vals);
5473 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5475 int sz=self->getNumberOfComponents();
5476 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5477 self->getTuple(tupleId,tmp);
5478 PyObject *ret=PyTuple_New(sz);
5479 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5483 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5486 int r1=(int)self->getMaxValue(tmp);
5487 PyObject *ret=PyTuple_New(2);
5488 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5489 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5493 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5496 int r1=(int)self->getMinValue(tmp);
5497 PyObject *ret=PyTuple_New(2);
5498 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5499 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5503 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5505 int nbOfCompo=self->getNumberOfComponents();
5510 if(PyInt_Check(obj))
5512 int val=(int)PyInt_AS_LONG(obj);
5513 return self->findIdFirstEqual(val);
5516 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5519 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5523 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5525 int nbOfCompo=self->getNumberOfComponents();
5532 if(PyInt_Check(obj))
5534 int val=(int)PyInt_AS_LONG(obj);
5535 return self->presenceOfValue(val);
5538 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5541 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5546 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5548 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5553 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5555 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5558 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5561 if(!self->isAllocated())
5562 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5563 PyObject *ret(PyTuple_New(1));
5564 PyObject *ret0(PyDict_New());
5565 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5566 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5567 PyObject *tmp1(PyInt_FromLong(0));
5568 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5569 PyTuple_SetItem(ret,0,ret0);
5573 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5577 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5579 self->checkAllocated();
5580 const char msg[]="Unexpected situation in __setitem__ !";
5581 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5584 std::vector<int> v1;
5586 DataArrayIntTuple *dd1=0;
5587 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5589 std::vector<int> vt1,vc1;
5590 std::pair<int, std::pair<int,int> > pt1,pc1;
5591 DataArrayInt *dt1=0,*dc1=0;
5592 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5593 MCAuto<DataArrayInt> tmp;
5601 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5604 throw INTERP_KERNEL::Exception(msg);
5613 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5616 throw INTERP_KERNEL::Exception(msg);
5625 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5628 throw INTERP_KERNEL::Exception(msg);
5637 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5640 throw INTERP_KERNEL::Exception(msg);
5649 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5652 throw INTERP_KERNEL::Exception(msg);
5661 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5664 throw INTERP_KERNEL::Exception(msg);
5673 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5676 throw INTERP_KERNEL::Exception(msg);
5685 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5688 throw INTERP_KERNEL::Exception(msg);
5697 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5700 throw INTERP_KERNEL::Exception(msg);
5709 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5712 throw INTERP_KERNEL::Exception(msg);
5721 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5724 throw INTERP_KERNEL::Exception(msg);
5733 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5736 throw INTERP_KERNEL::Exception(msg);
5745 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5748 throw INTERP_KERNEL::Exception(msg);
5757 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5760 throw INTERP_KERNEL::Exception(msg);
5769 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5772 throw INTERP_KERNEL::Exception(msg);
5781 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5784 throw INTERP_KERNEL::Exception(msg);
5789 throw INTERP_KERNEL::Exception(msg);
5796 class DataArrayByteTuple;
5798 class DataArrayByteIterator
5801 DataArrayByteIterator(DataArrayByte *da);
5802 ~DataArrayByteIterator();
5805 class DataArrayByteTuple
5808 std::string repr() const throw(INTERP_KERNEL::Exception);
5809 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5812 std::string __str__() const throw(INTERP_KERNEL::Exception)
5814 return self->repr();
5817 char __int__() const throw(INTERP_KERNEL::Exception)
5819 return self->byteValue();
5822 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5824 return self->buildDAByte(1,self->getNumberOfCompo());
5829 class DataArrayAsciiCharIterator;
5831 class DataArrayAsciiChar : public DataArrayChar
5834 static DataArrayAsciiChar *New();
5835 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5836 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5837 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5840 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5842 return DataArrayAsciiChar::New();
5845 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5847 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) !";
5848 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5852 if(PyInt_Check(nbOfTuples))
5854 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5856 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5859 if(PyInt_Check(nbOfComp))
5860 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5861 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5863 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5864 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5865 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5866 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5870 throw INTERP_KERNEL::Exception(msg);
5873 {//DataArrayAsciiChar.New([1,3,4],3)
5874 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5876 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5877 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5881 else if(PyString_Check(nbOfTuples))
5883 if(PyString_Size(nbOfTuples)!=1)
5884 throw INTERP_KERNEL::Exception(msg);
5885 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5886 std::vector<std::string> tmp;
5887 if(fillStringVector(elt0,tmp))
5888 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5890 throw INTERP_KERNEL::Exception(msg);
5893 throw INTERP_KERNEL::Exception(msg);
5897 std::vector<std::string> tmmp;
5898 if(fillStringVector(elt0,tmmp))
5899 //DataArrayAsciiChar.New(["abc","de","fghi"])
5900 return DataArrayAsciiChar::New(tmmp,' ');
5903 // DataArrayAsciiChar.New([1,3,4])
5904 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5905 int tmpp1=-1,tmpp2=-1;
5906 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5907 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5912 else if(PyInt_Check(elt0))
5914 int nbOfTuples1=PyInt_AS_LONG(elt0);
5916 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5921 if(PyInt_Check(nbOfTuples))
5922 {//DataArrayAsciiChar.New(5,2)
5923 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5925 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5926 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5927 ret->alloc(nbOfTuples1,nbOfCompo);
5931 throw INTERP_KERNEL::Exception(msg);
5934 throw INTERP_KERNEL::Exception(msg);
5937 {//DataArrayAsciiChar.New(5)
5938 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5939 ret->alloc(nbOfTuples1,1);
5944 throw INTERP_KERNEL::Exception(msg);
5947 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5949 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5952 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5954 std::ostringstream oss;
5955 self->reprQuickOverview(oss);
5959 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5961 return self->iterator();
5964 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5966 char tmp[2]; tmp[1]='\0';
5967 tmp[0]=self->getIJ(tupleId,compoId);
5968 return std::string(tmp);
5971 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5973 char tmp[2]; tmp[1]='\0';
5974 tmp[0]=self->getIJSafe(tupleId,compoId);
5975 return std::string(tmp);
5978 std::string __str__() const throw(INTERP_KERNEL::Exception)
5980 return self->repr();
5983 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5985 const char *vals=self->getConstPointer();
5986 int nbOfComp=self->getNumberOfComponents();
5987 int nbOfTuples=self->getNumberOfTuples();
5988 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5991 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5993 if(PyString_Check(tupl))
5995 Py_ssize_t sz=PyString_Size(tupl);
5996 std::vector<char> vals(sz);
5997 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5998 return self->presenceOfTuple(vals);
6001 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
6004 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
6006 if(PyString_Check(vals))
6008 Py_ssize_t sz=PyString_Size(vals);
6009 std::vector<char> vals2(sz);
6010 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
6011 return self->presenceOfValue(vals2);
6014 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
6017 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
6019 if(PyString_Check(vals))
6021 Py_ssize_t sz=PyString_Size(vals);
6022 std::vector<char> vals2(sz);
6023 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
6024 return self->findIdFirstEqual(vals2);
6027 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
6030 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
6032 if(PyString_Check(tupl))
6034 Py_ssize_t sz=PyString_Size(tupl);
6035 std::vector<char> vals(sz);
6036 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
6037 return self->findIdFirstEqualTuple(vals);
6040 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
6043 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
6045 if(PyString_Check(strOrListOfInt))
6047 Py_ssize_t sz=PyString_Size(strOrListOfInt);
6048 std::vector<char> vals(sz);
6049 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
6050 return self->findIdSequence(vals);
6053 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
6056 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
6058 int sz=self->getNumberOfComponents();
6059 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
6060 self->getTuple(tupleId,tmp);
6061 return PyString_FromString(tmp);
6064 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
6067 char tmp2[2]; tmp2[1]='\0';
6068 tmp2[0]=self->getMaxValue(tmp);
6069 PyObject *ret=PyTuple_New(2);
6070 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
6071 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
6075 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
6078 char tmp2[2]; tmp2[1]='\0';
6079 tmp2[0]=self->getMinValue(tmp);
6080 PyObject *ret=PyTuple_New(2);
6081 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
6082 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
6086 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
6088 int nbOfCompo=self->getNumberOfComponents();
6093 if(PyString_Check(obj))
6095 Py_ssize_t sz=PyString_Size(obj);
6096 char *pt=PyString_AsString(obj);
6098 return self->findIdFirstEqual(pt[0]);
6100 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
6103 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
6106 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
6110 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
6112 int nbOfCompo=self->getNumberOfComponents();
6119 if(PyString_Check(obj))
6121 Py_ssize_t sz=PyString_Size(obj);
6122 char *pt=PyString_AsString(obj);
6124 return self->presenceOfValue(pt[0]);
6126 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
6129 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
6132 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
6136 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
6139 std::vector<int> stdvecTyyppArr;
6140 std::pair<int, std::pair<int,int> > sTyyppArr;
6141 MEDCoupling::DataArrayInt *daIntTyypp=0;
6142 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
6146 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
6148 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
6150 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
6152 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
6154 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
6158 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
6160 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.";
6162 std::vector<int> stdvecTyyppArr;
6163 std::pair<int, std::pair<int,int> > sTyyppArr;
6164 MEDCoupling::DataArrayInt *daIntTyypp=0;
6165 int nbOfCompo=self->getNumberOfComponents();
6166 int nbOfTuples=self->getNumberOfTuples();
6167 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
6169 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
6170 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
6179 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
6185 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6186 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6189 //value vector<string>
6192 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6193 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6196 //value DataArrayChar
6199 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6203 throw INTERP_KERNEL::Exception(msg);
6207 {//obj list-tuple[int]
6213 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6219 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6220 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6223 //value vector<string>
6226 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6227 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6230 //value DataArrayChar
6233 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6237 throw INTERP_KERNEL::Exception(msg);
6248 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6254 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6255 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6258 //value vector<string>
6261 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6262 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6265 //value DataArrayChar
6268 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6272 throw INTERP_KERNEL::Exception(msg);
6283 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6289 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6290 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6293 //value vector<string>
6296 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6297 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6300 //value DataArrayChar
6303 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6307 throw INTERP_KERNEL::Exception(msg);
6312 throw INTERP_KERNEL::Exception(msg);
6318 class DataArrayAsciiCharTuple;
6320 class DataArrayAsciiCharIterator
6323 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6324 ~DataArrayAsciiCharIterator();
6329 DataArrayAsciiCharTuple *ret=self->nextt();
6331 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6334 PyErr_SetString(PyExc_StopIteration,"No more data.");
6341 class DataArrayAsciiCharTuple
6344 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6345 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6348 std::string __str__() const throw(INTERP_KERNEL::Exception)
6350 return self->repr();
6353 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6355 return self->buildDAAsciiChar(1,self->getNumberOfCompo());