1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
22 %typemap(out) MEDCoupling::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) MEDCoupling::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
45 %newobject MEDCoupling::DataArray::deepCopy;
46 %newobject MEDCoupling::DataArray::buildNewEmptyInstance;
47 %newobject MEDCoupling::DataArray::selectByTupleRanges;
48 %newobject MEDCoupling::DataArray::selectByTupleId;
49 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
50 %newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
51 %newobject MEDCoupling::DataArray::Aggregate;
52 %newobject MEDCoupling::DataArrayInt::New;
53 %newobject MEDCoupling::DataArrayInt::__iter__;
54 %newobject MEDCoupling::DataArrayInt::selectPartDef;
55 %newobject MEDCoupling::DataArrayInt::convertToDblArr;
56 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
57 %newobject MEDCoupling::DataArrayInt::subArray;
58 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
59 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
60 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
61 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
62 %newobject MEDCoupling::DataArrayInt::renumber;
63 %newobject MEDCoupling::DataArrayInt::renumberR;
64 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
65 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
66 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
67 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
68 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
69 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
70 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
71 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
72 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
73 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
74 %newobject MEDCoupling::DataArrayInt::negate;
75 %newobject MEDCoupling::DataArrayInt::computeAbs;
76 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
77 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
78 %newobject MEDCoupling::DataArrayInt::findIdsStricltyNegative;
79 %newobject MEDCoupling::DataArrayInt::Aggregate;
80 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
81 %newobject MEDCoupling::DataArrayInt::Meld;
82 %newobject MEDCoupling::DataArrayInt::Add;
83 %newobject MEDCoupling::DataArrayInt::Substract;
84 %newobject MEDCoupling::DataArrayInt::Multiply;
85 %newobject MEDCoupling::DataArrayInt::Divide;
86 %newobject MEDCoupling::DataArrayInt::Pow;
87 %newobject MEDCoupling::DataArrayInt::BuildUnion;
88 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
89 %newobject MEDCoupling::DataArrayInt::Range;
90 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
91 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
92 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
93 %newobject MEDCoupling::DataArrayInt::buildComplement;
94 %newobject MEDCoupling::DataArrayInt::buildUnion;
95 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
96 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
97 %newobject MEDCoupling::DataArrayInt::buildIntersection;
98 %newobject MEDCoupling::DataArrayInt::buildUnique;
99 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
100 %newobject MEDCoupling::DataArrayInt::fromLinkedListOfPairToList;
101 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
102 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
103 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
104 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
105 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
106 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
107 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
108 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
109 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
110 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
111 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
112 %newobject MEDCoupling::DataArrayInt::__neg__;
113 %newobject MEDCoupling::DataArrayInt::__add__;
114 %newobject MEDCoupling::DataArrayInt::__radd__;
115 %newobject MEDCoupling::DataArrayInt::__sub__;
116 %newobject MEDCoupling::DataArrayInt::__rsub__;
117 %newobject MEDCoupling::DataArrayInt::__mul__;
118 %newobject MEDCoupling::DataArrayInt::__rmul__;
119 %newobject MEDCoupling::DataArrayInt::__div__;
120 %newobject MEDCoupling::DataArrayInt::__rdiv__;
121 %newobject MEDCoupling::DataArrayInt::__mod__;
122 %newobject MEDCoupling::DataArrayInt::__rmod__;
123 %newobject MEDCoupling::DataArrayInt::__pow__;
124 %newobject MEDCoupling::DataArrayInt::__rpow__;
125 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
126 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
127 %newobject MEDCoupling::DataArrayChar::renumber;
128 %newobject MEDCoupling::DataArrayChar::renumberR;
129 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
130 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
131 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
132 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
133 %newobject MEDCoupling::DataArrayChar::Aggregate;
134 %newobject MEDCoupling::DataArrayChar::Meld;
135 %newobject MEDCoupling::DataArrayByte::New;
136 %newobject MEDCoupling::DataArrayByte::__iter__;
137 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
138 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
139 %newobject MEDCoupling::DataArrayChar::subArray;
140 %newobject MEDCoupling::DataArrayAsciiChar::New;
141 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
142 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
143 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
144 %newobject MEDCoupling::DataArrayDouble::New;
145 %newobject MEDCoupling::DataArrayDouble::__iter__;
146 %newobject MEDCoupling::DataArrayDouble::selectPartDef;
147 %newobject MEDCoupling::DataArrayDouble::convertToIntArr;
148 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
149 %newobject MEDCoupling::DataArrayDouble::Aggregate;
150 %newobject MEDCoupling::DataArrayDouble::Meld;
151 %newobject MEDCoupling::DataArrayDouble::Dot;
152 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
153 %newobject MEDCoupling::DataArrayDouble::Add;
154 %newobject MEDCoupling::DataArrayDouble::Substract;
155 %newobject MEDCoupling::DataArrayDouble::Multiply;
156 %newobject MEDCoupling::DataArrayDouble::Divide;
157 %newobject MEDCoupling::DataArrayDouble::Pow;
158 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
159 %newobject MEDCoupling::DataArrayDouble::subArray;
160 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
161 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
162 %newobject MEDCoupling::DataArrayDouble::cumSum;
163 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
164 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
165 %newobject MEDCoupling::DataArrayDouble::negate;
166 %newobject MEDCoupling::DataArrayDouble::computeAbs;
167 %newobject MEDCoupling::DataArrayDouble::applyFunc;
168 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
169 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
170 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
171 %newobject MEDCoupling::DataArrayDouble::determinant;
172 %newobject MEDCoupling::DataArrayDouble::eigenValues;
173 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
174 %newobject MEDCoupling::DataArrayDouble::inverse;
175 %newobject MEDCoupling::DataArrayDouble::trace;
176 %newobject MEDCoupling::DataArrayDouble::deviator;
177 %newobject MEDCoupling::DataArrayDouble::magnitude;
178 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
179 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
180 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
181 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
182 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
183 %newobject MEDCoupling::DataArrayDouble::renumber;
184 %newobject MEDCoupling::DataArrayDouble::renumberR;
185 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
186 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
187 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
188 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
189 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
190 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
191 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
192 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
193 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
194 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
195 %newobject MEDCoupling::DataArrayDouble::cartesianize;
196 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
197 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
198 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
199 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
200 %newobject MEDCoupling::DataArrayDouble::__neg__;
201 %newobject MEDCoupling::DataArrayDouble::__radd__;
202 %newobject MEDCoupling::DataArrayDouble::__rsub__;
203 %newobject MEDCoupling::DataArrayDouble::__rmul__;
204 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
205 %newobject MEDCoupling::DataArrayDouble::__pow__;
206 %newobject MEDCoupling::DataArrayDouble::__rpow__;
207 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
209 %newobject MEDCoupling::PartDefinition::New;
210 %newobject MEDCoupling::PartDefinition::toDAI;
211 %newobject MEDCoupling::PartDefinition::__add__;
212 %newobject MEDCoupling::PartDefinition::composeWith;
213 %newobject MEDCoupling::PartDefinition::tryToSimplify;
214 %newobject MEDCoupling::DataArrayPartDefinition::New;
215 %newobject MEDCoupling::SlicePartDefinition::New;
218 %feature("unref") DataArray "$this->decrRef();"
219 %feature("unref") DataArrayDouble "$this->decrRef();"
220 %feature("unref") DataArrayInt "$this->decrRef();"
221 %feature("unref") DataArrayChar "$this->decrRef();"
222 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
223 %feature("unref") DataArrayByte "$this->decrRef();"
225 %feature("unref") PartDefinition "$this->decrRef();"
226 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
227 %feature("unref") SlicePartDefinition "$this->decrRef();"
229 namespace MEDCoupling
236 } MEDCouplingAxisType;
240 class PartDefinition : public RefCountObject, public TimeLabel
243 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
244 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
245 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
246 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
247 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
248 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
249 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
250 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
253 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
255 return (*self)+other;
258 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
261 bool ret0(self->isEqual(other,ret1));
262 PyObject *ret=PyTuple_New(2);
263 PyObject *ret0Py=ret0?Py_True:Py_False;
265 PyTuple_SetItem(ret,0,ret0Py);
266 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
270 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
272 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
276 virtual ~PartDefinition();
279 class DataArrayPartDefinition : public PartDefinition
282 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
285 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
287 return DataArrayPartDefinition::New(listOfIds);
290 std::string __str__() const throw(INTERP_KERNEL::Exception)
292 return self->getRepr();
295 std::string __repr__() const throw(INTERP_KERNEL::Exception)
297 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
298 oss << self->getRepr();
303 virtual ~DataArrayPartDefinition();
306 class SlicePartDefinition : public PartDefinition
309 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
310 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
313 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
315 return SlicePartDefinition::New(start,stop,step);
318 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
321 self->getSlice(a,b,c);
322 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
325 std::string __str__() const throw(INTERP_KERNEL::Exception)
327 return self->getRepr();
330 std::string __repr__() const throw(INTERP_KERNEL::Exception)
332 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
333 oss << self->getRepr();
338 virtual ~SlicePartDefinition();
341 class DataArray : public RefCountObject, public TimeLabel
344 void setName(const std::string& name);
345 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
346 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
347 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
348 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
349 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
350 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
351 std::string getName() const;
352 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
353 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
354 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
355 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
356 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
357 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
358 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
359 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
360 int getNumberOfComponents() const;
361 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
362 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
363 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
364 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
365 virtual void desallocate() throw(INTERP_KERNEL::Exception);
366 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
367 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
368 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
369 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
370 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
371 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
372 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
373 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
374 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
375 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
376 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
377 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
378 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
379 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
380 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
381 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
382 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
383 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
384 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
385 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
386 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
387 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
388 void updateTime() const;
391 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
393 const std::vector<std::string>& comps=self->getInfoOnComponents();
394 PyObject *ret=PyList_New((int)comps.size());
395 for(int i=0;i<(int)comps.size();i++)
396 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
400 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
402 std::vector<int> tmp;
403 convertPyToNewIntArr3(li,tmp);
404 self->copyPartOfStringInfoFrom(other,tmp);
407 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
409 std::vector<int> tmp;
410 convertPyToNewIntArr3(li,tmp);
411 self->copyPartOfStringInfoFrom2(tmp,other);
414 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
417 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
418 if (!SWIG_IsOK(res1))
421 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
422 if(size!=self->getNumberOfTuples())
424 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
426 self->renumberInPlace(tmp);
430 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
432 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
433 da2->checkAllocated();
434 int size=self->getNumberOfTuples();
435 if(size!=self->getNumberOfTuples())
437 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
439 self->renumberInPlace(da2->getConstPointer());
443 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
446 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
447 if (!SWIG_IsOK(res1))
450 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
451 if(size!=self->getNumberOfTuples())
453 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
455 self->renumberInPlaceR(tmp);
459 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
461 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
462 da2->checkAllocated();
463 int size=self->getNumberOfTuples();
464 if(size!=self->getNumberOfTuples())
466 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
468 self->renumberInPlaceR(da2->getConstPointer());
472 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
473 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
475 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
476 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
477 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
478 DataArrayInt *tuplesSelecPtr2=0;
481 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
483 throw INTERP_KERNEL::Exception(msg);
485 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
488 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
490 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
491 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
494 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
496 std::vector<std::pair<int,int> > ranges;
497 convertPyToVectorPairInt(li,ranges);
498 return self->selectByTupleRanges(ranges);
501 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
504 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
505 if (!SWIG_IsOK(res1))
508 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
509 return self->selectByTupleId(tmp,tmp+size);
513 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
515 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
516 da2->checkAllocated();
517 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
521 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
524 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
525 if (!SWIG_IsOK(res1))
528 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
529 return self->selectByTupleIdSafe(tmp,tmp+size);
533 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
535 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
536 da2->checkAllocated();
537 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
541 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
543 std::vector<int> tmp;
544 convertPyToNewIntArr3(li,tmp);
545 DataArray *ret=self->keepSelectedComponents(tmp);
546 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
549 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
551 if(!PySlice_Check(slic))
552 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
553 Py_ssize_t strt=2,stp=2,step=2;
554 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
555 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
557 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
558 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
561 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
563 if(!PySlice_Check(slic))
564 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
565 Py_ssize_t strt=2,stp=2,step=2;
566 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
567 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
569 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
570 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
573 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
575 if(!PySlice_Check(slic))
576 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
577 Py_ssize_t strt=2,stp=2,step=2;
578 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
579 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
580 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
583 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
585 if(!PySlice_Check(slic))
586 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
587 Py_ssize_t strt=2,stp=2,step=2;
588 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
589 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
590 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
593 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
595 std::vector<const DataArray *> tmp;
596 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
597 return DataArray::Aggregate(tmp);
600 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
602 if(!PySlice_Check(slic))
603 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
604 Py_ssize_t strt=2,stp=2,step=2;
605 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
606 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
607 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
610 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
612 if(!PySlice_Check(slic))
613 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
614 Py_ssize_t strt=2,stp=2,step=2;
615 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
616 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
617 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
620 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
622 PyObject *ret(PyTuple_New(2));
623 std::string a0(self->getName());
624 const std::vector<std::string> &a1(self->getInfoOnComponents());
625 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
628 PyObject *ret1(PyList_New(sz));
629 for(int i=0;i<sz;i++)
630 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
631 PyTuple_SetItem(ret,1,ret1);
636 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
638 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 !";
639 if(!PyTuple_Check(inp))
640 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
641 int sz(PyTuple_Size(inp));
643 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
644 PyObject *a0(PyTuple_GetItem(inp,0));
645 if(!PyString_Check(a0))
646 throw INTERP_KERNEL::Exception(MSG);
647 PyObject *a1(PyTuple_GetItem(inp,1));
648 std::vector<std::string> a1cpp;
649 if(!fillStringVector(a1,a1cpp))
650 throw INTERP_KERNEL::Exception(MSG);
651 self->setName(PyString_AsString(a0));
652 self->setInfoOnComponents(a1cpp);
658 class DataArrayDoubleIterator;
660 class DataArrayDouble : public DataArray
663 static DataArrayDouble *New();
664 double doubleValue() const throw(INTERP_KERNEL::Exception);
665 bool empty() const throw(INTERP_KERNEL::Exception);
666 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
667 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
668 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
669 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
670 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
671 double popBackSilent() throw(INTERP_KERNEL::Exception);
672 void pack() const throw(INTERP_KERNEL::Exception);
673 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
674 void fillWithZero() throw(INTERP_KERNEL::Exception);
675 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
676 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
677 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
678 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
679 void reverse() throw(INTERP_KERNEL::Exception);
680 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
681 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
682 std::string repr() const throw(INTERP_KERNEL::Exception);
683 std::string reprZip() const throw(INTERP_KERNEL::Exception);
684 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
685 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
686 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
687 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
688 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
689 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
690 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
691 void transpose() throw(INTERP_KERNEL::Exception);
692 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
693 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
694 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
695 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
696 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
697 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
698 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
699 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
700 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
701 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
702 double front() const throw(INTERP_KERNEL::Exception);
703 double back() const throw(INTERP_KERNEL::Exception);
704 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
705 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
706 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
707 double *getPointer() throw(INTERP_KERNEL::Exception);
708 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
709 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
710 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
711 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
712 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
713 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
714 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
715 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
716 double getAverageValue() const throw(INTERP_KERNEL::Exception);
717 double norm2() const throw(INTERP_KERNEL::Exception);
718 double normMax() const throw(INTERP_KERNEL::Exception);
719 double normMin() const throw(INTERP_KERNEL::Exception);
720 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
721 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
722 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
723 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
724 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
725 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
726 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
727 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
728 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
729 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
730 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
731 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
732 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
733 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
734 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
735 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
736 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
737 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
738 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
739 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
740 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
741 void abs() throw(INTERP_KERNEL::Exception);
742 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
743 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
744 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
745 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
746 void applyPow(double val) throw(INTERP_KERNEL::Exception);
747 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
748 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
749 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
750 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
751 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
752 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
753 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
754 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
755 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
756 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
757 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
758 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
759 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
760 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
761 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
762 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
763 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
764 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
765 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
766 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
767 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
768 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
769 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
770 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
771 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
772 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
773 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
774 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
777 DataArrayDouble() throw(INTERP_KERNEL::Exception)
779 return DataArrayDouble::New();
782 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
784 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)";
785 std::string msg(msgBase);
787 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
790 if(PyList_Check(elt0) || PyTuple_Check(elt0))
794 if(PyInt_Check(nbOfTuples))
796 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
798 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
801 if(PyInt_Check(elt2))
802 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
803 int nbOfCompo=PyInt_AS_LONG(elt2);
805 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
806 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
807 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
808 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
812 throw INTERP_KERNEL::Exception(msg.c_str());
815 {//DataArrayDouble.New([1.,3.,4.],3)
816 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
818 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
819 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
824 throw INTERP_KERNEL::Exception(msg.c_str());
827 {// DataArrayDouble.New([1.,3.,4.])
828 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
829 int tmpp1=-1,tmpp2=-1;
830 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
831 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
835 else if(PyInt_Check(elt0))
837 int nbOfTuples1=PyInt_AS_LONG(elt0);
839 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
844 if(PyInt_Check(nbOfTuples))
845 {//DataArrayDouble.New(5,2)
846 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
848 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
849 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
850 ret->alloc(nbOfTuples1,nbOfCompo);
854 throw INTERP_KERNEL::Exception(msg.c_str());
857 throw INTERP_KERNEL::Exception(msg.c_str());
860 {//DataArrayDouble.New(5)
861 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
862 ret->alloc(nbOfTuples1,1);
867 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
868 {//DataArrayDouble.New(numpyArray)
869 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
873 throw INTERP_KERNEL::Exception(msg.c_str());
874 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
877 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
879 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
882 DataArrayDouble *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
884 MCAuto<DataArrayDouble> ret(self->selectPartDef(pd));
888 DataArrayDouble *cumSum() const throw(INTERP_KERNEL::Exception)
890 MCAuto<DataArrayDouble> ret(self->cumSum());
894 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
897 std::vector<double> bb;
899 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
900 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
901 self->pushBackValsSilent(tmp,tmp+nbTuples);
904 std::string __repr__() const throw(INTERP_KERNEL::Exception)
906 std::ostringstream oss;
907 self->reprQuickOverview(oss);
911 std::string __str__() const throw(INTERP_KERNEL::Exception)
913 return self->reprNotTooLong();
916 double __float__() const throw(INTERP_KERNEL::Exception)
918 return self->doubleValue();
921 int __len__() const throw(INTERP_KERNEL::Exception)
923 if(self->isAllocated())
925 return self->getNumberOfTuples();
929 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
933 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
935 return self->iterator();
938 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
940 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 !";
941 if(PyList_Check(li) || PyTuple_Check(li))
945 if(PyInt_Check(nbOfTuples))
947 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
949 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
952 if(PyInt_Check(nbOfComp))
953 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
954 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
956 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
957 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
958 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
961 throw INTERP_KERNEL::Exception(msg);
964 {//DataArrayDouble.setValues([1.,3.,4.],3)
966 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
967 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
971 throw INTERP_KERNEL::Exception(msg);
974 {// DataArrayDouble.setValues([1.,3.,4.])
975 int tmpp1=-1,tmpp2=-1;
976 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
977 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
981 throw INTERP_KERNEL::Exception(msg);
984 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
986 const double *vals=self->getConstPointer();
987 return convertDblArrToPyList(vals,self->getNbOfElems());
991 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
993 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
997 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1000 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1001 PyObject *ret=PyTuple_New(2);
1002 PyObject *ret0Py=ret0?Py_True:Py_False;
1004 PyTuple_SetItem(ret,0,ret0Py);
1005 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1009 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1011 const double *vals=self->getConstPointer();
1012 int nbOfComp=self->getNumberOfComponents();
1013 int nbOfTuples=self->getNumberOfTuples();
1014 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
1017 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1019 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1021 DataArrayDouble *a,*a2;
1022 DataArrayDoubleTuple *aa,*aa2;
1023 std::vector<double> bb,bb2;
1025 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1026 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1027 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1031 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1033 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1035 DataArrayDouble *a,*a2;
1036 DataArrayDoubleTuple *aa,*aa2;
1037 std::vector<double> bb,bb2;
1039 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1041 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1042 return convertDblArrToPyListOfTuple(res,3,3);
1045 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1047 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1049 DataArrayDouble *a,*a2;
1050 DataArrayDoubleTuple *aa,*aa2;
1051 std::vector<double> bb,bb2;
1053 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1054 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1055 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1058 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1061 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1062 if (!SWIG_IsOK(res1))
1065 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1066 if(size!=self->getNumberOfTuples())
1068 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1070 return self->renumber(tmp);
1074 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1076 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1077 da2->checkAllocated();
1078 int size=self->getNumberOfTuples();
1079 if(size!=self->getNumberOfTuples())
1081 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1083 return self->renumber(da2->getConstPointer());
1087 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1090 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1091 if (!SWIG_IsOK(res1))
1094 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1095 if(size!=self->getNumberOfTuples())
1097 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1099 return self->renumberR(tmp);
1103 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1105 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1106 da2->checkAllocated();
1107 int size=self->getNumberOfTuples();
1108 if(size!=self->getNumberOfTuples())
1110 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1112 return self->renumberR(da2->getConstPointer());
1116 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1119 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1120 if (!SWIG_IsOK(res1))
1123 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1124 if(size!=self->getNumberOfTuples())
1126 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1128 return self->renumberAndReduce(tmp,newNbOfTuple);
1132 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1134 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1135 da2->checkAllocated();
1136 int size=self->getNumberOfTuples();
1137 if(size!=self->getNumberOfTuples())
1139 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1141 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1145 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1147 int thisTupleId,otherTupleId;
1148 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1149 PyObject *ret=PyTuple_New(3);
1150 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1151 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1152 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1156 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1159 double r1=self->getMaxValue(tmp);
1160 PyObject *ret=PyTuple_New(2);
1161 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1162 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1166 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1169 double r1=self->getMaxValue2(tmp);
1170 PyObject *ret=PyTuple_New(2);
1171 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1172 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1176 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1179 double r1=self->getMinValue(tmp);
1180 PyObject *ret=PyTuple_New(2);
1181 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1182 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1186 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1189 double r1=self->getMinValue2(tmp);
1190 PyObject *ret=PyTuple_New(2);
1191 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1192 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1196 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1198 int nbOfCompo=self->getNumberOfComponents();
1199 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1200 self->getMinMaxPerComponent(tmp);
1201 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1205 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1207 int sz=self->getNumberOfComponents();
1208 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1209 self->accumulate(tmp);
1210 return convertDblArrToPyList(tmp,sz);
1213 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1216 std::vector<int> val2;
1217 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1218 return self->accumulatePerChunck(bg,bg+sz);
1221 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1223 DataArrayInt *comm, *commIndex;
1224 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1225 PyObject *res = PyList_New(2);
1226 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1227 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1231 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1235 DataArrayDoubleTuple *aa;
1236 std::vector<double> bb;
1238 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1239 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1241 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1242 PyObject *ret=PyTuple_New(2);
1243 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1244 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1248 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1250 std::vector<int> tmp;
1251 convertPyToNewIntArr3(li,tmp);
1252 self->setSelectedComponents(a,tmp);
1255 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1257 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1258 std::size_t sz(retCpp.size());
1259 PyObject *res(PyList_New(sz));
1260 for(std::size_t i=0;i<sz;i++)
1261 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1265 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1267 int sz=self->getNumberOfComponents();
1268 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1269 self->getTuple(tupleId,tmp);
1270 return convertDblArrToPyList(tmp,sz);
1273 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1275 std::vector<const DataArrayDouble *> tmp;
1276 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1277 return DataArrayDouble::Aggregate(tmp);
1280 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1282 std::vector<const DataArrayDouble *> tmp;
1283 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1284 return DataArrayDouble::Meld(tmp);
1287 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1291 DataArrayDoubleTuple *aa;
1292 std::vector<double> bb;
1294 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1295 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1296 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1297 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1298 DataArrayInt *c=0,*cI=0;
1299 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1300 PyObject *ret=PyTuple_New(2);
1301 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1302 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1306 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1308 DataArrayInt *ret1=0;
1309 bool ret0=self->areIncludedInMe(other,prec,ret1);
1310 PyObject *ret=PyTuple_New(2);
1311 PyObject *ret0Py=ret0?Py_True:Py_False;
1313 PyTuple_SetItem(ret,0,ret0Py);
1314 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1318 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1320 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1321 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1322 self->checkAllocated();
1323 int nbOfTuples=self->getNumberOfTuples();
1324 int nbOfComponents=self->getNumberOfComponents();
1326 std::vector<int> vt1,vc1;
1327 std::pair<int, std::pair<int,int> > pt1,pc1;
1328 DataArrayInt *dt1=0,*dc1=0;
1330 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1331 MCAuto<DataArrayDouble> ret;
1335 if(nbOfComponents==1)
1336 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1337 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1339 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1341 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1343 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1345 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1348 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1349 std::vector<int> v2(1,ic1);
1350 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1354 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1355 std::vector<int> v2(1,ic1);
1356 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1360 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1361 std::vector<int> v2(1,ic1);
1362 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1366 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1367 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1371 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1372 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1376 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1377 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1381 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1382 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1386 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1387 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1388 std::vector<int> v2(nbOfComp);
1389 for(int i=0;i<nbOfComp;i++)
1390 v2[i]=pc1.first+i*pc1.second.second;
1391 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1395 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1396 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1397 std::vector<int> v2(nbOfComp);
1398 for(int i=0;i<nbOfComp;i++)
1399 v2[i]=pc1.first+i*pc1.second.second;
1400 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1404 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1405 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1406 std::vector<int> v2(nbOfComp);
1407 for(int i=0;i<nbOfComp;i++)
1408 v2[i]=pc1.first+i*pc1.second.second;
1409 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1413 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1414 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1415 std::vector<int> v2(nbOfComp);
1416 for(int i=0;i<nbOfComp;i++)
1417 v2[i]=pc1.first+i*pc1.second.second;
1418 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1421 throw INTERP_KERNEL::Exception(msg);
1425 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1427 self->checkAllocated();
1428 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1429 int nbOfTuples=self->getNumberOfTuples();
1430 int nbOfComponents=self->getNumberOfComponents();
1433 std::vector<double> v1;
1434 DataArrayDouble *d1=0;
1435 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1437 std::vector<int> vt1,vc1;
1438 std::pair<int, std::pair<int,int> > pt1,pc1;
1439 DataArrayInt *dt1=0,*dc1=0;
1440 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1441 MCAuto<DataArrayDouble> tmp;
1449 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1452 tmp=DataArrayDouble::New();
1453 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1454 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1457 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1460 throw INTERP_KERNEL::Exception(msg);
1469 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1472 tmp=DataArrayDouble::New();
1473 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1474 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1477 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1480 throw INTERP_KERNEL::Exception(msg);
1489 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1492 tmp=DataArrayDouble::New();
1493 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1494 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1497 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1500 throw INTERP_KERNEL::Exception(msg);
1509 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1512 tmp=DataArrayDouble::New();
1513 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1514 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1517 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1520 throw INTERP_KERNEL::Exception(msg);
1529 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1532 tmp=DataArrayDouble::New();
1533 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1534 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1537 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1540 throw INTERP_KERNEL::Exception(msg);
1549 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1552 tmp=DataArrayDouble::New();
1553 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1554 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1557 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1560 throw INTERP_KERNEL::Exception(msg);
1569 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1572 tmp=DataArrayDouble::New();
1573 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1574 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1577 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1580 throw INTERP_KERNEL::Exception(msg);
1589 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1592 tmp=DataArrayDouble::New();
1593 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1594 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1597 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1600 throw INTERP_KERNEL::Exception(msg);
1609 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1612 tmp=DataArrayDouble::New();
1613 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1614 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1617 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1620 throw INTERP_KERNEL::Exception(msg);
1629 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1632 tmp=DataArrayDouble::New();
1633 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1634 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1637 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1640 throw INTERP_KERNEL::Exception(msg);
1649 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1652 tmp=DataArrayDouble::New();
1653 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1654 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1657 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1660 throw INTERP_KERNEL::Exception(msg);
1669 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1672 tmp=DataArrayDouble::New();
1673 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1674 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1677 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1680 throw INTERP_KERNEL::Exception(msg);
1689 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1692 tmp=DataArrayDouble::New();
1693 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1694 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1697 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1700 throw INTERP_KERNEL::Exception(msg);
1709 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1712 tmp=DataArrayDouble::New();
1713 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1714 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1717 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1720 throw INTERP_KERNEL::Exception(msg);
1729 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1732 tmp=DataArrayDouble::New();
1733 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1734 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1737 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1740 throw INTERP_KERNEL::Exception(msg);
1749 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1752 tmp=DataArrayDouble::New();
1753 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1754 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1757 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1760 throw INTERP_KERNEL::Exception(msg);
1765 throw INTERP_KERNEL::Exception(msg);
1770 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1772 return self->negate();
1775 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1777 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1780 DataArrayDoubleTuple *aa;
1781 std::vector<double> bb;
1784 #ifndef WITHOUT_AUTOFIELD
1786 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1788 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1791 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1792 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1794 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1797 throw INTERP_KERNEL::Exception(msg);
1801 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1806 MCAuto<DataArrayDouble> ret=self->deepCopy();
1807 ret->applyLin(1.,val);
1808 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1812 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1816 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1817 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1821 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1822 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1825 throw INTERP_KERNEL::Exception(msg);
1829 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1831 const char msg[]="Unexpected situation in __radd__ !";
1834 DataArrayDoubleTuple *aa;
1835 std::vector<double> bb;
1837 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1842 MCAuto<DataArrayDouble> ret=self->deepCopy();
1843 ret->applyLin(1.,val);
1848 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1849 return DataArrayDouble::Add(self,aaa);
1853 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1854 return DataArrayDouble::Add(self,aaa);
1857 throw INTERP_KERNEL::Exception(msg);
1861 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1863 const char msg[]="Unexpected situation in __iadd__ !";
1866 DataArrayDoubleTuple *aa;
1867 std::vector<double> bb;
1869 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1874 self->applyLin(1.,val);
1875 Py_XINCREF(trueSelf);
1881 Py_XINCREF(trueSelf);
1886 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1887 self->addEqual(aaa);
1888 Py_XINCREF(trueSelf);
1893 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1894 self->addEqual(aaa);
1895 Py_XINCREF(trueSelf);
1899 throw INTERP_KERNEL::Exception(msg);
1903 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1905 const char msg[]="Unexpected situation in __sub__ !";
1908 DataArrayDoubleTuple *aa;
1909 std::vector<double> bb;
1912 #ifndef WITHOUT_AUTOFIELD
1914 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1916 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1919 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1920 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1922 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1925 throw INTERP_KERNEL::Exception(msg);
1929 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1934 MCAuto<DataArrayDouble> ret=self->deepCopy();
1935 ret->applyLin(1.,-val);
1936 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1940 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1944 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1945 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1949 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1950 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1953 throw INTERP_KERNEL::Exception(msg);
1957 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1959 const char msg[]="Unexpected situation in __rsub__ !";
1962 DataArrayDoubleTuple *aa;
1963 std::vector<double> bb;
1965 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1970 MCAuto<DataArrayDouble> ret=self->deepCopy();
1971 ret->applyLin(-1.,val);
1976 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1977 return DataArrayDouble::Substract(aaa,self);
1981 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1982 return DataArrayDouble::Substract(aaa,self);
1985 throw INTERP_KERNEL::Exception(msg);
1989 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1991 const char msg[]="Unexpected situation in __isub__ !";
1994 DataArrayDoubleTuple *aa;
1995 std::vector<double> bb;
1997 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2002 self->applyLin(1,-val);
2003 Py_XINCREF(trueSelf);
2008 self->substractEqual(a);
2009 Py_XINCREF(trueSelf);
2014 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2015 self->substractEqual(aaa);
2016 Py_XINCREF(trueSelf);
2021 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2022 self->substractEqual(aaa);
2023 Py_XINCREF(trueSelf);
2027 throw INTERP_KERNEL::Exception(msg);
2031 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2033 const char msg[]="Unexpected situation in __mul__ !";
2036 DataArrayDoubleTuple *aa;
2037 std::vector<double> bb;
2040 #ifndef WITHOUT_AUTOFIELD
2042 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
2044 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
2047 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
2048 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
2050 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
2053 throw INTERP_KERNEL::Exception(msg);
2057 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2062 MCAuto<DataArrayDouble> ret=self->deepCopy();
2063 ret->applyLin(val,0.);
2064 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2068 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2072 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2073 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2077 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2078 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2081 throw INTERP_KERNEL::Exception(msg);
2085 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2087 const char msg[]="Unexpected situation in __rmul__ !";
2090 DataArrayDoubleTuple *aa;
2091 std::vector<double> bb;
2093 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2098 MCAuto<DataArrayDouble> ret=self->deepCopy();
2099 ret->applyLin(val,0.);
2104 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2105 return DataArrayDouble::Multiply(self,aaa);
2109 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2110 return DataArrayDouble::Multiply(self,aaa);
2113 throw INTERP_KERNEL::Exception(msg);
2117 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2119 const char msg[]="Unexpected situation in __imul__ !";
2122 DataArrayDoubleTuple *aa;
2123 std::vector<double> bb;
2125 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2130 self->applyLin(val,0.);
2131 Py_XINCREF(trueSelf);
2136 self->multiplyEqual(a);
2137 Py_XINCREF(trueSelf);
2142 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2143 self->multiplyEqual(aaa);
2144 Py_XINCREF(trueSelf);
2149 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2150 self->multiplyEqual(aaa);
2151 Py_XINCREF(trueSelf);
2155 throw INTERP_KERNEL::Exception(msg);
2159 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2161 const char msg[]="Unexpected situation in __div__ !";
2164 DataArrayDoubleTuple *aa;
2165 std::vector<double> bb;
2168 #ifndef WITHOUT_AUTOFIELD
2170 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
2172 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
2175 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
2176 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
2178 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
2181 throw INTERP_KERNEL::Exception(msg);
2185 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2191 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2192 MCAuto<DataArrayDouble> ret=self->deepCopy();
2193 ret->applyLin(1/val,0.);
2194 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2198 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2202 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2203 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2207 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2208 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2211 throw INTERP_KERNEL::Exception(msg);
2215 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2217 const char msg[]="Unexpected situation in __rdiv__ !";
2220 DataArrayDoubleTuple *aa;
2221 std::vector<double> bb;
2223 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2228 MCAuto<DataArrayDouble> ret=self->deepCopy();
2234 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2235 return DataArrayDouble::Divide(aaa,self);
2239 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2240 return DataArrayDouble::Divide(aaa,self);
2243 throw INTERP_KERNEL::Exception(msg);
2247 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2249 const char msg[]="Unexpected situation in __idiv__ !";
2252 DataArrayDoubleTuple *aa;
2253 std::vector<double> bb;
2255 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2261 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2262 self->applyLin(1./val,0.);
2263 Py_XINCREF(trueSelf);
2268 self->divideEqual(a);
2269 Py_XINCREF(trueSelf);
2274 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2275 self->divideEqual(aaa);
2276 Py_XINCREF(trueSelf);
2281 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2282 self->divideEqual(aaa);
2283 Py_XINCREF(trueSelf);
2287 throw INTERP_KERNEL::Exception(msg);
2291 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2293 const char msg[]="Unexpected situation in __pow__ !";
2296 DataArrayDoubleTuple *aa;
2297 std::vector<double> bb;
2299 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2304 MCAuto<DataArrayDouble> ret=self->deepCopy();
2310 return DataArrayDouble::Pow(self,a);
2314 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2315 return DataArrayDouble::Pow(self,aaa);
2319 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2320 return DataArrayDouble::Pow(self,aaa);
2323 throw INTERP_KERNEL::Exception(msg);
2327 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2329 const char msg[]="Unexpected situation in __rpow__ !";
2332 DataArrayDoubleTuple *aa;
2333 std::vector<double> bb;
2335 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2340 MCAuto<DataArrayDouble> ret=self->deepCopy();
2341 ret->applyRPow(val);
2346 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2347 return DataArrayDouble::Pow(aaa,self);
2351 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2352 return DataArrayDouble::Pow(aaa,self);
2355 throw INTERP_KERNEL::Exception(msg);
2359 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2361 const char msg[]="Unexpected situation in __ipow__ !";
2364 DataArrayDoubleTuple *aa;
2365 std::vector<double> bb;
2367 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2372 self->applyPow(val);
2373 Py_XINCREF(trueSelf);
2379 Py_XINCREF(trueSelf);
2384 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2385 self->powEqual(aaa);
2386 Py_XINCREF(trueSelf);
2391 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2392 self->powEqual(aaa);
2393 Py_XINCREF(trueSelf);
2397 throw INTERP_KERNEL::Exception(msg);
2401 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2403 DataArrayInt *c=0,*cI=0;
2405 self->computeTupleIdsNearTuples(other,eps,c,cI);
2406 PyObject *ret=PyTuple_New(2);
2407 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2408 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2412 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2414 DataArrayInt *ret1=0;
2415 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2416 PyObject *ret=PyTuple_New(2);
2417 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2418 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2423 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2425 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
2428 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2431 if(!self->isAllocated())
2432 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2433 PyObject *ret(PyTuple_New(1));
2434 PyObject *ret0(PyDict_New());
2435 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2436 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2437 PyObject *tmp1(PyInt_FromLong(0));
2438 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2439 PyTuple_SetItem(ret,0,ret0);
2443 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2449 class DataArrayDoubleTuple;
2451 class DataArrayDoubleIterator
2454 DataArrayDoubleIterator(DataArrayDouble *da);
2455 ~DataArrayDoubleIterator();
2460 DataArrayDoubleTuple *ret=self->nextt();
2462 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2465 PyErr_SetString(PyExc_StopIteration,"No more data.");
2472 class DataArrayDoubleTuple
2475 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2476 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2479 std::string __str__() const throw(INTERP_KERNEL::Exception)
2481 return self->repr();
2484 double __float__() const throw(INTERP_KERNEL::Exception)
2486 return self->doubleValue();
2489 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2491 return self->buildDADouble(1,self->getNumberOfCompo());
2494 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2496 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2497 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2498 Py_XINCREF(trueSelf);
2502 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2504 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2505 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2506 Py_XINCREF(trueSelf);
2510 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2512 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2513 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2514 Py_XINCREF(trueSelf);
2518 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2520 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2521 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2522 Py_XINCREF(trueSelf);
2526 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2528 return PyInt_FromLong(self->getNumberOfCompo());
2531 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2533 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2536 std::vector<int> multiVal;
2537 std::pair<int, std::pair<int,int> > slic;
2538 MEDCoupling::DataArrayInt *daIntTyypp=0;
2539 const double *pt=self->getConstPointer();
2540 int nbc=self->getNumberOfCompo();
2541 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2548 std::ostringstream oss;
2549 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2550 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2554 return PyFloat_FromDouble(pt[singleVal]);
2558 return PyFloat_FromDouble(pt[nbc+singleVal]);
2561 std::ostringstream oss;
2562 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2563 throw INTERP_KERNEL::Exception(oss.str().c_str());
2569 PyObject *t=PyTuple_New(multiVal.size());
2570 for(int j=0;j<(int)multiVal.size();j++)
2572 int cid=multiVal[j];
2575 std::ostringstream oss;
2576 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2577 throw INTERP_KERNEL::Exception(oss.str().c_str());
2579 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2585 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2586 PyObject *t=PyTuple_New(sz);
2587 for(int j=0;j<sz;j++)
2588 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2592 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2596 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2598 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2599 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2602 std::vector<double> multiValV;
2603 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2604 int nbc=self->getNumberOfCompo();
2605 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2607 std::vector<int> multiVal;
2608 std::pair<int, std::pair<int,int> > slic;
2609 MEDCoupling::DataArrayInt *daIntTyypp=0;
2610 double *pt=self->getPointer();
2611 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2618 std::ostringstream oss;
2619 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2620 throw INTERP_KERNEL::Exception(oss.str().c_str());
2626 pt[singleVal]=singleValV;
2631 if(multiValV.size()!=1)
2633 std::ostringstream oss;
2634 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2635 throw INTERP_KERNEL::Exception(oss.str().c_str());
2637 pt[singleVal]=multiValV[0];
2642 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2646 throw INTERP_KERNEL::Exception(msg);
2655 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2659 std::ostringstream oss;
2660 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2661 throw INTERP_KERNEL::Exception(oss.str().c_str());
2669 if(multiVal.size()!=multiValV.size())
2671 std::ostringstream oss;
2672 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2673 throw INTERP_KERNEL::Exception(oss.str().c_str());
2675 for(int i=0;i<(int)multiVal.size();i++)
2677 int pos=multiVal[i];
2680 std::ostringstream oss;
2681 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2682 throw INTERP_KERNEL::Exception(oss.str().c_str());
2684 pt[multiVal[i]]=multiValV[i];
2690 const double *ptV=daIntTyyppV->getConstPointer();
2691 if(nbc>daIntTyyppV->getNumberOfCompo())
2693 std::ostringstream oss;
2694 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2695 throw INTERP_KERNEL::Exception(oss.str().c_str());
2697 std::copy(ptV,ptV+nbc,pt);
2701 throw INTERP_KERNEL::Exception(msg);
2706 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2711 for(int j=0;j<sz;j++)
2712 pt[slic.first+j*slic.second.second]=singleValV;
2717 if(sz!=(int)multiValV.size())
2719 std::ostringstream oss;
2720 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2721 throw INTERP_KERNEL::Exception(oss.str().c_str());
2723 for(int j=0;j<sz;j++)
2724 pt[slic.first+j*slic.second.second]=multiValV[j];
2729 const double *ptV=daIntTyyppV->getConstPointer();
2730 if(sz>daIntTyyppV->getNumberOfCompo())
2732 std::ostringstream oss;
2733 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2734 throw INTERP_KERNEL::Exception(oss.str().c_str());
2736 for(int j=0;j<sz;j++)
2737 pt[slic.first+j*slic.second.second]=ptV[j];
2741 throw INTERP_KERNEL::Exception(msg);
2745 throw INTERP_KERNEL::Exception(msg);
2751 class DataArrayIntIterator;
2753 class DataArrayInt : public DataArray
2756 static DataArrayInt *New();
2757 int intValue() const throw(INTERP_KERNEL::Exception);
2758 int getHashCode() const throw(INTERP_KERNEL::Exception);
2759 bool empty() const throw(INTERP_KERNEL::Exception);
2760 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2761 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2762 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2763 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2764 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2765 int popBackSilent() throw(INTERP_KERNEL::Exception);
2766 void pack() const throw(INTERP_KERNEL::Exception);
2767 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2768 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2769 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2770 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2771 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2772 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2773 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2774 void reverse() throw(INTERP_KERNEL::Exception);
2775 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2776 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2777 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2778 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2779 void fillWithZero() throw(INTERP_KERNEL::Exception);
2780 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2781 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2782 std::string repr() const throw(INTERP_KERNEL::Exception);
2783 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2784 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2785 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2786 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2787 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2788 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2789 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2790 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2791 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2792 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2793 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2794 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2795 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2796 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2797 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2798 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2799 void transpose() throw(INTERP_KERNEL::Exception);
2800 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2801 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2802 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2803 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2804 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2805 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2806 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2807 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2808 int front() const throw(INTERP_KERNEL::Exception);
2809 int back() const throw(INTERP_KERNEL::Exception);
2810 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2811 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2812 int *getPointer() throw(INTERP_KERNEL::Exception);
2813 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2814 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2815 const int *begin() const throw(INTERP_KERNEL::Exception);
2816 const int *end() const throw(INTERP_KERNEL::Exception);
2817 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2818 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2819 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2820 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2821 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2822 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2823 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2824 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2825 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2826 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2827 int count(int value) const throw(INTERP_KERNEL::Exception);
2828 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2829 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2830 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2831 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2832 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2833 void abs() throw(INTERP_KERNEL::Exception);
2834 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2835 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2836 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2837 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2838 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2839 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2840 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2841 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2842 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2843 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2844 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2845 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2846 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2847 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2848 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2849 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2850 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2851 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2852 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2853 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2854 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2855 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2856 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2857 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2858 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2859 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2860 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2861 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2862 void computeOffsets() throw(INTERP_KERNEL::Exception);
2863 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2864 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2865 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2866 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2867 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2868 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2869 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2870 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2871 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2872 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2873 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2874 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2875 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2876 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2877 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2878 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2879 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2880 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2881 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2883 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2886 DataArrayInt() throw(INTERP_KERNEL::Exception)
2888 return DataArrayInt::New();
2891 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2893 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)";
2894 std::string msg(msgBase);
2896 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2899 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2903 if(PyInt_Check(nbOfTuples))
2905 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2907 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2910 if(PyInt_Check(nbOfComp))
2911 {//DataArrayInt.New([1,3,4,5],2,2)
2912 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2914 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2915 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2916 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2917 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2921 throw INTERP_KERNEL::Exception(msg.c_str());
2924 {//DataArrayInt.New([1,3,4],3)
2925 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2927 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2928 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2933 throw INTERP_KERNEL::Exception(msg.c_str());
2936 {// DataArrayInt.New([1,3,4])
2937 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2938 int tmpp1=-1,tmpp2=-1;
2939 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2940 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2944 else if(PyInt_Check(elt0))
2946 int nbOfTuples1=PyInt_AS_LONG(elt0);
2948 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2953 if(PyInt_Check(nbOfTuples))
2954 {//DataArrayInt.New(5,2)
2955 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2957 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2958 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2959 ret->alloc(nbOfTuples1,nbOfCompo);
2963 throw INTERP_KERNEL::Exception(msg.c_str());
2966 throw INTERP_KERNEL::Exception(msg.c_str());
2969 {//DataArrayInt.New(5)
2970 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2971 ret->alloc(nbOfTuples1,1);
2976 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2977 {//DataArrayInt.New(numpyArray)
2978 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2982 throw INTERP_KERNEL::Exception(msg.c_str());
2983 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2986 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2988 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2991 std::string __str__() const throw(INTERP_KERNEL::Exception)
2993 return self->reprNotTooLong();
2996 int __len__() const throw(INTERP_KERNEL::Exception)
2998 if(self->isAllocated())
3000 return self->getNumberOfTuples();
3004 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
3008 int __int__() const throw(INTERP_KERNEL::Exception)
3010 return self->intValue();
3013 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
3015 return self->iterator();
3018 DataArrayInt *fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception)
3020 MCAuto<DataArrayInt> ret(self->fromLinkedListOfPairToList());
3024 DataArrayInt *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
3026 MCAuto<DataArrayInt> ret(self->selectPartDef(pd));
3030 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3032 int sz=self->getNumberOfComponents();
3033 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3034 self->accumulate(tmp);
3035 return convertIntArrToPyList(tmp,sz);
3038 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
3041 std::vector<int> val2;
3042 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
3043 return self->accumulatePerChunck(bg,bg+sz);
3046 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
3049 std::vector<int> val2;
3050 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
3051 return self->findIdsEqualTuple(bg,bg+sz);
3054 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
3056 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
3057 PyObject *ret=PyList_New(slcs.size());
3058 for(std::size_t i=0;i<slcs.size();i++)
3059 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
3063 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
3065 if(!PySlice_Check(slic))
3066 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
3067 Py_ssize_t strt=2,stp=2,step=2;
3068 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
3069 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
3070 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
3071 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 !");
3072 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
3075 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
3078 self->getMinMaxValues(a,b);
3079 PyObject *ret=PyTuple_New(2);
3080 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
3081 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
3085 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
3087 int newNbOfTuples=-1;
3088 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
3089 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
3090 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
3091 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
3092 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
3093 PyObject *ret=PyTuple_New(2);
3094 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3095 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
3099 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
3101 MCAuto<DataArrayInt> ret(DataArrayInt::New());
3102 int szArr,sw,iTypppArr;
3103 std::vector<int> stdvecTyyppArr;
3104 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
3105 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
3106 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
3110 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3112 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 !";
3113 if(PyList_Check(li) || PyTuple_Check(li))
3115 if(nbOfTuples && nbOfTuples != Py_None)
3117 if(PyInt_Check(nbOfTuples))
3119 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
3121 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
3122 if(nbOfComp && nbOfComp != Py_None)
3124 if(PyInt_Check(nbOfComp))
3125 {//DataArrayInt.setValues([1,3,4,5],2,2)
3126 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
3128 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
3129 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
3130 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
3133 throw INTERP_KERNEL::Exception(msg);
3136 {//DataArrayInt.setValues([1,3,4],3)
3138 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
3139 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
3143 throw INTERP_KERNEL::Exception(msg);
3146 {// DataArrayInt.setValues([1,3,4])
3147 int tmpp1=-1,tmpp2=-1;
3148 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
3149 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
3153 throw INTERP_KERNEL::Exception(msg);
3156 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
3158 const int *vals=self->getConstPointer();
3159 return convertIntArrToPyList(vals,self->getNbOfElems());
3163 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
3165 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
3169 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
3172 bool ret0=self->isEqualIfNotWhy(other,ret1);
3173 PyObject *ret=PyTuple_New(2);
3174 PyObject *ret0Py=ret0?Py_True:Py_False;
3176 PyTuple_SetItem(ret,0,ret0Py);
3177 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3181 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
3183 const int *vals=self->getConstPointer();
3184 int nbOfComp=self->getNumberOfComponents();
3185 int nbOfTuples=self->getNumberOfTuples();
3186 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
3189 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
3191 std::vector<const DataArrayInt *> groups;
3192 std::vector< std::vector<int> > fidsOfGroups;
3193 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
3194 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3195 PyObject *ret = PyList_New(2);
3196 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3197 int sz=fidsOfGroups.size();
3198 PyObject *ret1 = PyList_New(sz);
3199 for(int i=0;i<sz;i++)
3200 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3201 PyList_SetItem(ret,1,ret1);
3205 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3208 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3209 if (!SWIG_IsOK(res1))
3212 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3213 self->transformWithIndArr(tmp,tmp+size);
3217 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3218 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3222 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3226 std::vector<int> multiVal;
3227 std::pair<int, std::pair<int,int> > slic;
3228 MEDCoupling::DataArrayInt *daIntTyypp=0;
3229 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3233 return self->findIdsEqualList(&singleVal,&singleVal+1);
3235 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3237 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3239 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3243 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3247 std::vector<int> multiVal;
3248 std::pair<int, std::pair<int,int> > slic;
3249 MEDCoupling::DataArrayInt *daIntTyypp=0;
3250 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3254 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
3256 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3258 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3260 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3264 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3266 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3268 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3269 if (!SWIG_IsOK(res1))
3272 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3273 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3277 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3279 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3280 da2->checkAllocated();
3281 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
3283 PyObject *ret = PyList_New(3);
3284 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3285 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3286 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3290 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3293 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3294 if (!SWIG_IsOK(res1))
3297 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3298 return self->transformWithIndArrR(tmp,tmp+size);
3302 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3303 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3307 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3310 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3311 if (!SWIG_IsOK(res1))
3314 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3315 if(size!=self->getNumberOfTuples())
3317 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3319 return self->renumberAndReduce(tmp,newNbOfTuple);
3323 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3325 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3326 da2->checkAllocated();
3327 int size=self->getNumberOfTuples();
3328 if(size!=self->getNumberOfTuples())
3330 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3332 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3336 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3339 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3340 if (!SWIG_IsOK(res1))
3343 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3344 if(size!=self->getNumberOfTuples())
3346 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3348 return self->renumber(tmp);
3352 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3354 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3355 da2->checkAllocated();
3356 int size=self->getNumberOfTuples();
3357 if(size!=self->getNumberOfTuples())
3359 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3361 return self->renumber(da2->getConstPointer());
3365 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3368 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3369 if (!SWIG_IsOK(res1))
3372 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3373 if(size!=self->getNumberOfTuples())
3375 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3377 return self->renumberR(tmp);
3381 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3383 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3384 da2->checkAllocated();
3385 int size=self->getNumberOfTuples();
3386 if(size!=self->getNumberOfTuples())
3388 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3390 return self->renumberR(da2->getConstPointer());
3394 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3396 std::vector<int> tmp;
3397 convertPyToNewIntArr3(li,tmp);
3398 self->setSelectedComponents(a,tmp);
3401 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
3403 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
3404 std::size_t sz(retCpp.size());
3405 PyObject *res(PyList_New(sz));
3406 for(std::size_t i=0;i<sz;i++)
3407 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3411 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3413 int sz=self->getNumberOfComponents();
3414 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3415 self->getTuple(tupleId,tmp);
3416 return convertIntArrToPyList(tmp,sz);
3419 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3421 DataArrayInt *arr=0;
3422 DataArrayInt *arrI=0;
3423 self->changeSurjectiveFormat(targetNb,arr,arrI);
3424 PyObject *res = PyList_New(2);
3425 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3426 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3430 static DataArrayInt *Meld(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::Meld(tmp);
3437 static DataArrayInt *Aggregate(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::Aggregate(tmp);
3444 static DataArrayInt *AggregateIndexes(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::AggregateIndexes(tmp);
3451 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3453 std::vector<const DataArrayInt *> tmp;
3454 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3455 return DataArrayInt::BuildUnion(tmp);
3458 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3460 std::vector<const DataArrayInt *> tmp;
3461 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3462 return DataArrayInt::BuildIntersection(tmp);
3465 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3468 int r1=self->getMaxValue(tmp);
3469 PyObject *ret=PyTuple_New(2);
3470 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3471 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3475 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3478 int r1=self->getMinValue(tmp);
3479 PyObject *ret=PyTuple_New(2);
3480 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3481 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3485 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3487 int nbOfCompo=self->getNumberOfComponents();
3492 if(PyInt_Check(obj))
3494 int val=(int)PyInt_AS_LONG(obj);
3495 return self->findIdFirstEqual(val);
3498 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3502 std::vector<int> arr;
3503 convertPyToNewIntArr3(obj,arr);
3504 return self->findIdFirstEqualTuple(arr);
3509 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3511 int nbOfCompo=self->getNumberOfComponents();
3518 if(PyInt_Check(obj))
3520 int val=(int)PyInt_AS_LONG(obj);
3521 return self->presenceOfValue(val);
3524 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3528 std::vector<int> arr;
3529 convertPyToNewIntArr3(obj,arr);
3530 return self->presenceOfTuple(arr);
3535 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3537 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3538 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3539 self->checkAllocated();
3540 int nbOfTuples=self->getNumberOfTuples();
3541 int nbOfComponents=self->getNumberOfComponents();
3543 std::vector<int> vt1,vc1;
3544 std::pair<int, std::pair<int,int> > pt1,pc1;
3545 DataArrayInt *dt1=0,*dc1=0;
3547 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3548 MCAuto<DataArrayInt> ret;
3553 if(nbOfComponents==1)
3554 return PyInt_FromLong(self->getIJSafe(it1,0));
3555 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3558 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3560 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3562 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3564 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3567 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3568 std::vector<int> v2(1,ic1);
3569 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3573 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3574 std::vector<int> v2(1,ic1);
3575 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3579 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3580 std::vector<int> v2(1,ic1);
3581 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3585 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3586 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3590 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3591 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3595 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3596 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3600 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3601 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3605 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3606 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3607 std::vector<int> v2(nbOfComp);
3608 for(int i=0;i<nbOfComp;i++)
3609 v2[i]=pc1.first+i*pc1.second.second;
3610 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3614 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3615 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3616 std::vector<int> v2(nbOfComp);
3617 for(int i=0;i<nbOfComp;i++)
3618 v2[i]=pc1.first+i*pc1.second.second;
3619 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3623 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3624 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3625 std::vector<int> v2(nbOfComp);
3626 for(int i=0;i<nbOfComp;i++)
3627 v2[i]=pc1.first+i*pc1.second.second;
3628 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3632 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3633 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3634 std::vector<int> v2(nbOfComp);
3635 for(int i=0;i<nbOfComp;i++)
3636 v2[i]=pc1.first+i*pc1.second.second;
3637 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3640 throw INTERP_KERNEL::Exception(msg);
3644 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3646 self->checkAllocated();
3647 const char msg[]="Unexpected situation in __setitem__ !";
3648 int nbOfTuples=self->getNumberOfTuples();
3649 int nbOfComponents=self->getNumberOfComponents();
3652 std::vector<int> v1;
3654 DataArrayIntTuple *dd1=0;
3655 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3657 std::vector<int> vt1,vc1;
3658 std::pair<int, std::pair<int,int> > pt1,pc1;
3659 DataArrayInt *dt1=0,*dc1=0;
3660 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3661 MCAuto<DataArrayInt> tmp;
3669 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3672 tmp=DataArrayInt::New();
3673 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3674 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3677 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3680 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3681 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3684 throw INTERP_KERNEL::Exception(msg);
3693 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3696 tmp=DataArrayInt::New();
3697 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3698 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3701 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3704 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3705 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3708 throw INTERP_KERNEL::Exception(msg);
3717 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3720 tmp=DataArrayInt::New();
3721 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3722 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3725 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3728 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3729 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3732 throw INTERP_KERNEL::Exception(msg);
3741 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3744 tmp=DataArrayInt::New();
3745 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3746 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3749 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3752 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3753 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3756 throw INTERP_KERNEL::Exception(msg);
3765 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3768 tmp=DataArrayInt::New();
3769 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3770 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3773 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3776 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3777 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3780 throw INTERP_KERNEL::Exception(msg);
3789 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3792 tmp=DataArrayInt::New();
3793 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3794 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3797 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3800 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3801 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3804 throw INTERP_KERNEL::Exception(msg);
3813 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3816 tmp=DataArrayInt::New();
3817 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3818 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3821 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3824 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3825 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3828 throw INTERP_KERNEL::Exception(msg);
3837 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3840 tmp=DataArrayInt::New();
3841 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3842 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3845 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3848 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3849 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3852 throw INTERP_KERNEL::Exception(msg);
3861 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3864 tmp=DataArrayInt::New();
3865 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3866 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3869 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3872 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3873 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3876 throw INTERP_KERNEL::Exception(msg);
3885 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3888 tmp=DataArrayInt::New();
3889 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3890 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3893 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3896 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3897 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3900 throw INTERP_KERNEL::Exception(msg);
3909 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3912 tmp=DataArrayInt::New();
3913 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3914 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3917 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3920 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3921 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3924 throw INTERP_KERNEL::Exception(msg);
3933 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3936 tmp=DataArrayInt::New();
3937 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3938 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3941 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3944 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3945 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3948 throw INTERP_KERNEL::Exception(msg);
3957 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3960 tmp=DataArrayInt::New();
3961 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3962 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3965 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3968 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3969 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3972 throw INTERP_KERNEL::Exception(msg);
3981 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3984 tmp=DataArrayInt::New();
3985 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3986 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3989 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3992 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3993 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3996 throw INTERP_KERNEL::Exception(msg);
4005 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
4008 tmp=DataArrayInt::New();
4009 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4010 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
4013 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
4016 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
4017 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
4020 throw INTERP_KERNEL::Exception(msg);
4029 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
4032 tmp=DataArrayInt::New();
4033 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
4034 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
4037 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
4040 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
4041 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
4044 throw INTERP_KERNEL::Exception(msg);
4049 throw INTERP_KERNEL::Exception(msg);
4054 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
4056 return self->negate();
4059 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4061 const char msg[]="Unexpected situation in __add__ !";
4064 std::vector<int> aa;
4065 DataArrayIntTuple *aaa;
4067 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4072 MCAuto<DataArrayInt> ret=self->deepCopy();
4073 ret->applyLin(1,val);
4078 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4079 return DataArrayInt::Add(self,aaaa);
4083 return DataArrayInt::Add(self,a);
4087 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4088 return DataArrayInt::Add(self,aaaa);
4091 throw INTERP_KERNEL::Exception(msg);
4095 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4097 const char msg[]="Unexpected situation in __radd__ !";
4100 std::vector<int> aa;
4101 DataArrayIntTuple *aaa;
4103 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4108 MCAuto<DataArrayInt> ret=self->deepCopy();
4109 ret->applyLin(1,val);
4114 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4115 return DataArrayInt::Add(self,aaaa);
4119 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4120 return DataArrayInt::Add(self,aaaa);
4123 throw INTERP_KERNEL::Exception(msg);
4127 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4129 const char msg[]="Unexpected situation in __iadd__ !";
4132 std::vector<int> aa;
4133 DataArrayIntTuple *aaa;
4135 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4140 self->applyLin(1,val);
4141 Py_XINCREF(trueSelf);
4146 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4148 Py_XINCREF(trueSelf);
4154 Py_XINCREF(trueSelf);
4159 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4160 self->addEqual(aaaa);
4161 Py_XINCREF(trueSelf);
4165 throw INTERP_KERNEL::Exception(msg);
4169 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4171 const char msg[]="Unexpected situation in __sub__ !";
4174 std::vector<int> aa;
4175 DataArrayIntTuple *aaa;
4177 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4182 MCAuto<DataArrayInt> ret=self->deepCopy();
4183 ret->applyLin(1,-val);
4188 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4189 return DataArrayInt::Substract(self,aaaa);
4193 return DataArrayInt::Substract(self,a);
4197 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4198 return DataArrayInt::Substract(self,aaaa);
4201 throw INTERP_KERNEL::Exception(msg);
4205 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4207 const char msg[]="Unexpected situation in __rsub__ !";
4210 std::vector<int> aa;
4211 DataArrayIntTuple *aaa;
4213 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4218 MCAuto<DataArrayInt> ret=self->deepCopy();
4219 ret->applyLin(-1,val);
4224 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4225 return DataArrayInt::Substract(aaaa,self);
4229 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4230 return DataArrayInt::Substract(aaaa,self);
4233 throw INTERP_KERNEL::Exception(msg);
4237 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4239 const char msg[]="Unexpected situation in __isub__ !";
4242 std::vector<int> aa;
4243 DataArrayIntTuple *aaa;
4245 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4250 self->applyLin(1,-val);
4251 Py_XINCREF(trueSelf);
4256 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4257 self->substractEqual(bb);
4258 Py_XINCREF(trueSelf);
4263 self->substractEqual(a);
4264 Py_XINCREF(trueSelf);
4269 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4270 self->substractEqual(aaaa);
4271 Py_XINCREF(trueSelf);
4275 throw INTERP_KERNEL::Exception(msg);
4279 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4281 const char msg[]="Unexpected situation in __mul__ !";
4284 std::vector<int> aa;
4285 DataArrayIntTuple *aaa;
4287 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4292 MCAuto<DataArrayInt> ret=self->deepCopy();
4293 ret->applyLin(val,0);
4298 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4299 return DataArrayInt::Multiply(self,aaaa);
4303 return DataArrayInt::Multiply(self,a);
4307 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4308 return DataArrayInt::Multiply(self,aaaa);
4311 throw INTERP_KERNEL::Exception(msg);
4315 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4317 const char msg[]="Unexpected situation in __rmul__ !";
4320 std::vector<int> aa;
4321 DataArrayIntTuple *aaa;
4323 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4328 MCAuto<DataArrayInt> ret=self->deepCopy();
4329 ret->applyLin(val,0);
4334 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4335 return DataArrayInt::Multiply(self,aaaa);
4339 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4340 return DataArrayInt::Multiply(self,aaaa);
4343 throw INTERP_KERNEL::Exception(msg);
4347 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4349 const char msg[]="Unexpected situation in __imul__ !";
4352 std::vector<int> aa;
4353 DataArrayIntTuple *aaa;
4355 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4360 self->applyLin(val,0);
4361 Py_XINCREF(trueSelf);
4366 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4367 self->multiplyEqual(bb);
4368 Py_XINCREF(trueSelf);
4373 self->multiplyEqual(a);
4374 Py_XINCREF(trueSelf);
4379 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4380 self->multiplyEqual(aaaa);
4381 Py_XINCREF(trueSelf);
4385 throw INTERP_KERNEL::Exception(msg);
4389 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4391 const char msg[]="Unexpected situation in __div__ !";
4394 std::vector<int> aa;
4395 DataArrayIntTuple *aaa;
4397 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4402 MCAuto<DataArrayInt> ret=self->deepCopy();
4403 ret->applyDivideBy(val);
4408 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4409 return DataArrayInt::Divide(self,aaaa);
4413 return DataArrayInt::Divide(self,a);
4417 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4418 return DataArrayInt::Divide(self,aaaa);
4421 throw INTERP_KERNEL::Exception(msg);
4425 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4427 const char msg[]="Unexpected situation in __rdiv__ !";
4430 std::vector<int> aa;
4431 DataArrayIntTuple *aaa;
4433 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4438 MCAuto<DataArrayInt> ret=self->deepCopy();
4444 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4445 return DataArrayInt::Divide(aaaa,self);
4449 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4450 return DataArrayInt::Divide(aaaa,self);
4453 throw INTERP_KERNEL::Exception(msg);
4457 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4459 const char msg[]="Unexpected situation in __idiv__ !";
4462 std::vector<int> aa;
4463 DataArrayIntTuple *aaa;
4465 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4470 self->applyDivideBy(val);
4471 Py_XINCREF(trueSelf);
4476 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4477 self->divideEqual(bb);
4478 Py_XINCREF(trueSelf);
4483 self->divideEqual(a);
4484 Py_XINCREF(trueSelf);
4489 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4490 self->divideEqual(aaaa);
4491 Py_XINCREF(trueSelf);
4495 throw INTERP_KERNEL::Exception(msg);
4499 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4501 const char msg[]="Unexpected situation in __mod__ !";
4504 std::vector<int> aa;
4505 DataArrayIntTuple *aaa;
4507 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4512 MCAuto<DataArrayInt> ret=self->deepCopy();
4513 ret->applyModulus(val);
4518 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4519 return DataArrayInt::Modulus(self,aaaa);
4523 return DataArrayInt::Modulus(self,a);
4527 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4528 return DataArrayInt::Modulus(self,aaaa);
4531 throw INTERP_KERNEL::Exception(msg);
4535 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4537 const char msg[]="Unexpected situation in __rmod__ !";
4540 std::vector<int> aa;
4541 DataArrayIntTuple *aaa;
4543 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4548 MCAuto<DataArrayInt> ret=self->deepCopy();
4549 ret->applyRModulus(val);
4554 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4555 return DataArrayInt::Modulus(aaaa,self);
4559 return DataArrayInt::Modulus(a,self);
4563 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4564 return DataArrayInt::Modulus(aaaa,self);
4567 throw INTERP_KERNEL::Exception(msg);
4571 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4573 const char msg[]="Unexpected situation in __imod__ !";
4576 std::vector<int> aa;
4577 DataArrayIntTuple *aaa;
4579 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4584 self->applyModulus(val);
4585 Py_XINCREF(trueSelf);
4590 self->modulusEqual(a);
4591 Py_XINCREF(trueSelf);
4596 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4597 self->modulusEqual(aaaa);
4598 Py_XINCREF(trueSelf);
4602 throw INTERP_KERNEL::Exception(msg);
4606 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4608 const char msg[]="Unexpected situation in __pow__ !";
4611 std::vector<int> aa;
4612 DataArrayIntTuple *aaa;
4614 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4619 MCAuto<DataArrayInt> ret=self->deepCopy();
4625 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4626 return DataArrayInt::Pow(self,aaaa);
4630 return DataArrayInt::Pow(self,a);
4634 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4635 return DataArrayInt::Pow(self,aaaa);
4638 throw INTERP_KERNEL::Exception(msg);
4642 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4644 const char msg[]="Unexpected situation in __rpow__ !";
4647 std::vector<int> aa;
4648 DataArrayIntTuple *aaa;
4650 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4655 MCAuto<DataArrayInt> ret=self->deepCopy();
4656 ret->applyRPow(val);
4661 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4662 return DataArrayInt::Pow(aaaa,self);
4666 return DataArrayInt::Pow(a,self);
4670 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4671 return DataArrayInt::Pow(aaaa,self);
4674 throw INTERP_KERNEL::Exception(msg);
4678 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4680 const char msg[]="Unexpected situation in __ipow__ !";
4683 std::vector<int> aa;
4684 DataArrayIntTuple *aaa;
4686 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4691 self->applyPow(val);
4692 Py_XINCREF(trueSelf);
4698 Py_XINCREF(trueSelf);
4703 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4704 self->powEqual(aaaa);
4705 Py_XINCREF(trueSelf);
4709 throw INTERP_KERNEL::Exception(msg);
4713 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4715 std::ostringstream oss;
4716 self->reprQuickOverview(oss);
4720 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4722 int szArr,sw,iTypppArr;
4723 std::vector<int> stdvecTyyppArr;
4724 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4725 self->pushBackValsSilent(tmp,tmp+szArr);
4728 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4730 std::vector<int> ret1;
4731 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4732 std::size_t sz=ret0.size();
4733 PyObject *pyRet=PyTuple_New(2);
4734 PyObject *pyRet0=PyList_New((int)sz);
4735 PyObject *pyRet1=PyList_New((int)sz);
4736 for(std::size_t i=0;i<sz;i++)
4738 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4739 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4741 PyTuple_SetItem(pyRet,0,pyRet0);
4742 PyTuple_SetItem(pyRet,1,pyRet1);
4746 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4748 DataArrayInt *ret0=0,*ret1=0;
4749 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4750 PyObject *pyRet=PyTuple_New(2);
4751 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4752 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4756 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4759 bool ret(self->isRange(a,b,c));
4760 PyObject *pyRet=PyTuple_New(2);
4761 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4763 PyTuple_SetItem(pyRet,0,ret0Py);
4765 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4771 PyTuple_SetItem(pyRet,1,ret1Py);
4776 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4778 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4781 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4784 if(!self->isAllocated())
4785 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4786 PyObject *ret(PyTuple_New(1));
4787 PyObject *ret0(PyDict_New());
4788 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4789 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4790 PyObject *tmp1(PyInt_FromLong(0));
4791 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4792 PyTuple_SetItem(ret,0,ret0);
4796 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4802 class DataArrayIntTuple;
4804 class DataArrayIntIterator
4807 DataArrayIntIterator(DataArrayInt *da);
4808 ~DataArrayIntIterator();
4813 DataArrayIntTuple *ret=self->nextt();
4815 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4818 PyErr_SetString(PyExc_StopIteration,"No more data.");
4825 class DataArrayIntTuple
4828 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4829 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4832 std::string __str__() const throw(INTERP_KERNEL::Exception)
4834 return self->repr();
4837 int __int__() const throw(INTERP_KERNEL::Exception)
4839 return self->intValue();
4842 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4844 return self->buildDAInt(1,self->getNumberOfCompo());
4847 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4849 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4850 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4851 Py_XINCREF(trueSelf);
4855 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4857 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4858 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4859 Py_XINCREF(trueSelf);
4863 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4865 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4866 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4867 Py_XINCREF(trueSelf);
4871 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4873 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4874 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4875 Py_XINCREF(trueSelf);
4879 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4881 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4882 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4883 Py_XINCREF(trueSelf);
4887 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4889 return PyInt_FromLong(self->getNumberOfCompo());
4892 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4894 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4897 std::vector<int> multiVal;
4898 std::pair<int, std::pair<int,int> > slic;
4899 MEDCoupling::DataArrayInt *daIntTyypp=0;
4900 const int *pt=self->getConstPointer();
4901 int nbc=self->getNumberOfCompo();
4902 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4909 std::ostringstream oss;
4910 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4911 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4915 return PyInt_FromLong(pt[singleVal]);
4919 return PyInt_FromLong(pt[nbc+singleVal]);
4922 std::ostringstream oss;
4923 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4924 throw INTERP_KERNEL::Exception(oss.str().c_str());
4930 PyObject *t=PyTuple_New(multiVal.size());
4931 for(int j=0;j<(int)multiVal.size();j++)
4933 int cid=multiVal[j];
4936 std::ostringstream oss;
4937 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4938 throw INTERP_KERNEL::Exception(oss.str().c_str());
4940 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4946 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4947 PyObject *t=PyTuple_New(sz);
4948 for(int j=0;j<sz;j++)
4949 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4953 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4957 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4959 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4960 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4963 std::vector<int> multiValV;
4964 std::pair<int, std::pair<int,int> > slicV;
4965 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4966 int nbc=self->getNumberOfCompo();
4967 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4969 std::vector<int> multiVal;
4970 std::pair<int, std::pair<int,int> > slic;
4971 MEDCoupling::DataArrayInt *daIntTyypp=0;
4972 int *pt=self->getPointer();
4973 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4980 std::ostringstream oss;
4981 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4982 throw INTERP_KERNEL::Exception(oss.str().c_str());
4988 pt[singleVal]=singleValV;
4993 if(multiValV.size()!=1)
4995 std::ostringstream oss;
4996 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4997 throw INTERP_KERNEL::Exception(oss.str().c_str());
4999 pt[singleVal]=multiValV[0];
5004 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
5008 throw INTERP_KERNEL::Exception(msg);
5017 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
5021 std::ostringstream oss;
5022 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
5023 throw INTERP_KERNEL::Exception(oss.str().c_str());
5031 if(multiVal.size()!=multiValV.size())
5033 std::ostringstream oss;
5034 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
5035 throw INTERP_KERNEL::Exception(oss.str().c_str());
5037 for(int i=0;i<(int)multiVal.size();i++)
5039 int pos=multiVal[i];
5042 std::ostringstream oss;
5043 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
5044 throw INTERP_KERNEL::Exception(oss.str().c_str());
5046 pt[multiVal[i]]=multiValV[i];
5052 const int *ptV=daIntTyyppV->getConstPointer();
5053 if(nbc>daIntTyyppV->getNumberOfCompo())
5055 std::ostringstream oss;
5056 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
5057 throw INTERP_KERNEL::Exception(oss.str().c_str());
5059 std::copy(ptV,ptV+nbc,pt);
5063 throw INTERP_KERNEL::Exception(msg);
5068 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
5073 for(int j=0;j<sz;j++)
5074 pt[slic.first+j*slic.second.second]=singleValV;
5079 if(sz!=(int)multiValV.size())
5081 std::ostringstream oss;
5082 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
5083 throw INTERP_KERNEL::Exception(oss.str().c_str());
5085 for(int j=0;j<sz;j++)
5086 pt[slic.first+j*slic.second.second]=multiValV[j];
5091 const int *ptV=daIntTyyppV->getConstPointer();
5092 if(sz>daIntTyyppV->getNumberOfCompo())
5094 std::ostringstream oss;
5095 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
5096 throw INTERP_KERNEL::Exception(oss.str().c_str());
5098 for(int j=0;j<sz;j++)
5099 pt[slic.first+j*slic.second.second]=ptV[j];
5103 throw INTERP_KERNEL::Exception(msg);
5107 throw INTERP_KERNEL::Exception(msg);
5113 class DataArrayChar : public DataArray
5116 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
5117 int getHashCode() const throw(INTERP_KERNEL::Exception);
5118 bool empty() const throw(INTERP_KERNEL::Exception);
5119 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
5120 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
5121 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
5122 char popBackSilent() throw(INTERP_KERNEL::Exception);
5123 void pack() const throw(INTERP_KERNEL::Exception);
5124 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
5125 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
5126 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
5127 void reverse() throw(INTERP_KERNEL::Exception);
5128 void fillWithZero() throw(INTERP_KERNEL::Exception);
5129 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
5130 std::string repr() const throw(INTERP_KERNEL::Exception);
5131 std::string reprZip() const throw(INTERP_KERNEL::Exception);
5132 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
5133 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
5134 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
5135 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
5136 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
5137 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
5138 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
5139 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
5140 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
5141 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
5142 char front() const throw(INTERP_KERNEL::Exception);
5143 char back() const throw(INTERP_KERNEL::Exception);
5144 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
5145 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
5146 char *getPointer() throw(INTERP_KERNEL::Exception);
5147 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
5148 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
5149 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
5150 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
5151 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
5152 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
5153 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
5154 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
5155 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
5156 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
5157 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
5160 int __len__() const throw(INTERP_KERNEL::Exception)
5162 if(self->isAllocated())
5164 return self->getNumberOfTuples();
5168 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
5172 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
5175 bool ret0=self->isEqualIfNotWhy(other,ret1);
5176 PyObject *ret=PyTuple_New(2);
5177 PyObject *ret0Py=ret0?Py_True:Py_False;
5179 PyTuple_SetItem(ret,0,ret0Py);
5180 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5184 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5187 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5188 if (!SWIG_IsOK(res1))
5191 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5192 if(size!=self->getNumberOfTuples())
5194 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5196 return self->renumber(tmp);
5200 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5202 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5203 da2->checkAllocated();
5204 int size=self->getNumberOfTuples();
5205 if(size!=self->getNumberOfTuples())
5207 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5209 return self->renumber(da2->getConstPointer());
5213 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5216 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5217 if (!SWIG_IsOK(res1))
5220 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5221 if(size!=self->getNumberOfTuples())
5223 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5225 return self->renumberR(tmp);
5229 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5231 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5232 da2->checkAllocated();
5233 int size=self->getNumberOfTuples();
5234 if(size!=self->getNumberOfTuples())
5236 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5238 return self->renumberR(da2->getConstPointer());
5242 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5245 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5246 if (!SWIG_IsOK(res1))
5249 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5250 if(size!=self->getNumberOfTuples())
5252 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5254 return self->renumberAndReduce(tmp,newNbOfTuple);
5258 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5260 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5261 da2->checkAllocated();
5262 int size=self->getNumberOfTuples();
5263 if(size!=self->getNumberOfTuples())
5265 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5267 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5271 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5273 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5274 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5275 return DataArrayChar::Aggregate(tmp);
5278 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5280 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5281 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5282 return DataArrayChar::Meld(tmp);
5287 class DataArrayByteIterator;
5289 class DataArrayByte : public DataArrayChar
5292 static DataArrayByte *New();
5293 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5294 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5295 char byteValue() const throw(INTERP_KERNEL::Exception);
5298 DataArrayByte() throw(INTERP_KERNEL::Exception)
5300 return DataArrayByte::New();
5303 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5305 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) !";
5306 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5310 if(PyInt_Check(nbOfTuples))
5312 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5314 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5317 if(PyInt_Check(nbOfComp))
5318 {//DataArrayByte.New([1,3,4,5],2,2)
5319 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5321 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5322 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5323 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5324 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5328 throw INTERP_KERNEL::Exception(msg);
5331 {//DataArrayByte.New([1,3,4],3)
5332 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5334 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5335 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5340 throw INTERP_KERNEL::Exception(msg);
5343 {// DataArrayByte.New([1,3,4])
5344 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5345 int tmpp1=-1,tmpp2=-1;
5346 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5347 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5351 else if(PyInt_Check(elt0))
5353 int nbOfTuples1=PyInt_AS_LONG(elt0);
5355 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5360 if(PyInt_Check(nbOfTuples))
5361 {//DataArrayByte.New(5,2)
5362 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5364 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5365 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5366 ret->alloc(nbOfTuples1,nbOfCompo);
5370 throw INTERP_KERNEL::Exception(msg);
5373 throw INTERP_KERNEL::Exception(msg);
5376 {//DataArrayByte.New(5)
5377 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5378 ret->alloc(nbOfTuples1,1);
5383 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
5384 {//DataArrayDouble.New(numpyArray)
5385 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
5389 throw INTERP_KERNEL::Exception(msg);
5392 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5394 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5397 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5399 std::ostringstream oss;
5400 self->reprQuickOverview(oss);
5404 int __int__() const throw(INTERP_KERNEL::Exception)
5406 return (int) self->byteValue();
5409 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5411 return self->iterator();
5414 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5416 return (int)self->getIJ(tupleId,compoId);
5419 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5421 return (int)self->getIJSafe(tupleId,compoId);
5424 std::string __str__() const throw(INTERP_KERNEL::Exception)
5426 return self->repr();
5429 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5431 const char *vals=self->getConstPointer();
5432 int nbOfComp=self->getNumberOfComponents();
5433 int nbOfTuples=self->getNumberOfTuples();
5434 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5437 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5440 int ival=-1; std::vector<int> ivval;
5441 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5442 std::vector<char> vals(sz);
5443 std::copy(pt,pt+sz,vals.begin());
5444 return self->presenceOfTuple(vals);
5447 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5450 int ival=-1; std::vector<int> ivval;
5451 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5452 std::vector<char> vals2(sz);
5453 std::copy(pt,pt+sz,vals2.begin());
5454 return self->presenceOfValue(vals2);
5457 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5460 int ival=-1; std::vector<int> ivval;
5461 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5462 std::vector<char> vals2(sz);
5463 std::copy(pt,pt+sz,vals2.begin());
5464 return self->findIdFirstEqual(vals2);
5467 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5470 int ival=-1; std::vector<int> ivval;
5471 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5472 std::vector<char> vals(sz);
5473 std::copy(pt,pt+sz,vals.begin());
5474 return self->findIdFirstEqualTuple(vals);
5477 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5480 int ival=-1; std::vector<int> ivval;
5481 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5482 std::vector<char> vals(sz);
5483 std::copy(pt,pt+sz,vals.begin());
5484 return self->findIdSequence(vals);
5487 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5489 int sz=self->getNumberOfComponents();
5490 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5491 self->getTuple(tupleId,tmp);
5492 PyObject *ret=PyTuple_New(sz);
5493 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5497 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5500 int r1=(int)self->getMaxValue(tmp);
5501 PyObject *ret=PyTuple_New(2);
5502 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5503 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5507 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5510 int r1=(int)self->getMinValue(tmp);
5511 PyObject *ret=PyTuple_New(2);
5512 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5513 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5517 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5519 int nbOfCompo=self->getNumberOfComponents();
5524 if(PyInt_Check(obj))
5526 int val=(int)PyInt_AS_LONG(obj);
5527 return self->findIdFirstEqual(val);
5530 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5533 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5537 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5539 int nbOfCompo=self->getNumberOfComponents();
5546 if(PyInt_Check(obj))
5548 int val=(int)PyInt_AS_LONG(obj);
5549 return self->presenceOfValue(val);
5552 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5555 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5560 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5562 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5567 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5569 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5572 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5575 if(!self->isAllocated())
5576 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5577 PyObject *ret(PyTuple_New(1));
5578 PyObject *ret0(PyDict_New());
5579 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5580 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5581 PyObject *tmp1(PyInt_FromLong(0));
5582 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5583 PyTuple_SetItem(ret,0,ret0);
5587 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5591 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5593 self->checkAllocated();
5594 const char msg[]="Unexpected situation in __setitem__ !";
5595 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5598 std::vector<int> v1;
5600 DataArrayIntTuple *dd1=0;
5601 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5603 std::vector<int> vt1,vc1;
5604 std::pair<int, std::pair<int,int> > pt1,pc1;
5605 DataArrayInt *dt1=0,*dc1=0;
5606 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5607 MCAuto<DataArrayInt> tmp;
5615 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5618 throw INTERP_KERNEL::Exception(msg);
5627 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5630 throw INTERP_KERNEL::Exception(msg);
5639 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5642 throw INTERP_KERNEL::Exception(msg);
5651 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5654 throw INTERP_KERNEL::Exception(msg);
5663 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5666 throw INTERP_KERNEL::Exception(msg);
5675 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5678 throw INTERP_KERNEL::Exception(msg);
5687 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5690 throw INTERP_KERNEL::Exception(msg);
5699 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5702 throw INTERP_KERNEL::Exception(msg);
5711 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5714 throw INTERP_KERNEL::Exception(msg);
5723 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5726 throw INTERP_KERNEL::Exception(msg);
5735 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5738 throw INTERP_KERNEL::Exception(msg);
5747 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5750 throw INTERP_KERNEL::Exception(msg);
5759 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5762 throw INTERP_KERNEL::Exception(msg);
5771 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5774 throw INTERP_KERNEL::Exception(msg);
5783 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5786 throw INTERP_KERNEL::Exception(msg);
5795 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5798 throw INTERP_KERNEL::Exception(msg);
5803 throw INTERP_KERNEL::Exception(msg);
5810 class DataArrayByteTuple;
5812 class DataArrayByteIterator
5815 DataArrayByteIterator(DataArrayByte *da);
5816 ~DataArrayByteIterator();
5819 class DataArrayByteTuple
5822 std::string repr() const throw(INTERP_KERNEL::Exception);
5823 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5826 std::string __str__() const throw(INTERP_KERNEL::Exception)
5828 return self->repr();
5831 char __int__() const throw(INTERP_KERNEL::Exception)
5833 return self->byteValue();
5836 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5838 return self->buildDAByte(1,self->getNumberOfCompo());
5843 class DataArrayAsciiCharIterator;
5845 class DataArrayAsciiChar : public DataArrayChar
5848 static DataArrayAsciiChar *New();
5849 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5850 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5851 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5854 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5856 return DataArrayAsciiChar::New();
5859 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5861 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) !";
5862 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5866 if(PyInt_Check(nbOfTuples))
5868 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5870 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5873 if(PyInt_Check(nbOfComp))
5874 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5875 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5877 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5878 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5879 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5880 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5884 throw INTERP_KERNEL::Exception(msg);
5887 {//DataArrayAsciiChar.New([1,3,4],3)
5888 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5890 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5891 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5895 else if(PyString_Check(nbOfTuples))
5897 if(PyString_Size(nbOfTuples)!=1)
5898 throw INTERP_KERNEL::Exception(msg);
5899 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5900 std::vector<std::string> tmp;
5901 if(fillStringVector(elt0,tmp))
5902 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5904 throw INTERP_KERNEL::Exception(msg);
5907 throw INTERP_KERNEL::Exception(msg);
5911 std::vector<std::string> tmmp;
5912 if(fillStringVector(elt0,tmmp))
5913 //DataArrayAsciiChar.New(["abc","de","fghi"])
5914 return DataArrayAsciiChar::New(tmmp,' ');
5917 // DataArrayAsciiChar.New([1,3,4])
5918 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5919 int tmpp1=-1,tmpp2=-1;
5920 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5921 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5926 else if(PyInt_Check(elt0))
5928 int nbOfTuples1=PyInt_AS_LONG(elt0);
5930 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5935 if(PyInt_Check(nbOfTuples))
5936 {//DataArrayAsciiChar.New(5,2)
5937 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5939 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5940 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5941 ret->alloc(nbOfTuples1,nbOfCompo);
5945 throw INTERP_KERNEL::Exception(msg);
5948 throw INTERP_KERNEL::Exception(msg);
5951 {//DataArrayAsciiChar.New(5)
5952 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5953 ret->alloc(nbOfTuples1,1);
5958 throw INTERP_KERNEL::Exception(msg);
5961 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5963 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5966 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5968 std::ostringstream oss;
5969 self->reprQuickOverview(oss);
5973 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5975 return self->iterator();
5978 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5980 char tmp[2]; tmp[1]='\0';
5981 tmp[0]=self->getIJ(tupleId,compoId);
5982 return std::string(tmp);
5985 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5987 char tmp[2]; tmp[1]='\0';
5988 tmp[0]=self->getIJSafe(tupleId,compoId);
5989 return std::string(tmp);
5992 std::string __str__() const throw(INTERP_KERNEL::Exception)
5994 return self->repr();
5997 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5999 const char *vals=self->getConstPointer();
6000 int nbOfComp=self->getNumberOfComponents();
6001 int nbOfTuples=self->getNumberOfTuples();
6002 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
6005 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
6007 if(PyString_Check(tupl))
6009 Py_ssize_t sz=PyString_Size(tupl);
6010 std::vector<char> vals(sz);
6011 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
6012 return self->presenceOfTuple(vals);
6015 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
6018 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
6020 if(PyString_Check(vals))
6022 Py_ssize_t sz=PyString_Size(vals);
6023 std::vector<char> vals2(sz);
6024 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
6025 return self->presenceOfValue(vals2);
6028 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
6031 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
6033 if(PyString_Check(vals))
6035 Py_ssize_t sz=PyString_Size(vals);
6036 std::vector<char> vals2(sz);
6037 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
6038 return self->findIdFirstEqual(vals2);
6041 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
6044 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
6046 if(PyString_Check(tupl))
6048 Py_ssize_t sz=PyString_Size(tupl);
6049 std::vector<char> vals(sz);
6050 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
6051 return self->findIdFirstEqualTuple(vals);
6054 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
6057 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
6059 if(PyString_Check(strOrListOfInt))
6061 Py_ssize_t sz=PyString_Size(strOrListOfInt);
6062 std::vector<char> vals(sz);
6063 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
6064 return self->findIdSequence(vals);
6067 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
6070 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
6072 int sz=self->getNumberOfComponents();
6073 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
6074 self->getTuple(tupleId,tmp);
6075 return PyString_FromString(tmp);
6078 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
6081 char tmp2[2]; tmp2[1]='\0';
6082 tmp2[0]=self->getMaxValue(tmp);
6083 PyObject *ret=PyTuple_New(2);
6084 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
6085 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
6089 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
6092 char tmp2[2]; tmp2[1]='\0';
6093 tmp2[0]=self->getMinValue(tmp);
6094 PyObject *ret=PyTuple_New(2);
6095 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
6096 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
6100 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
6102 int nbOfCompo=self->getNumberOfComponents();
6107 if(PyString_Check(obj))
6109 Py_ssize_t sz=PyString_Size(obj);
6110 char *pt=PyString_AsString(obj);
6112 return self->findIdFirstEqual(pt[0]);
6114 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
6117 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
6120 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
6124 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
6126 int nbOfCompo=self->getNumberOfComponents();
6133 if(PyString_Check(obj))
6135 Py_ssize_t sz=PyString_Size(obj);
6136 char *pt=PyString_AsString(obj);
6138 return self->presenceOfValue(pt[0]);
6140 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
6143 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
6146 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
6150 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
6153 std::vector<int> stdvecTyyppArr;
6154 std::pair<int, std::pair<int,int> > sTyyppArr;
6155 MEDCoupling::DataArrayInt *daIntTyypp=0;
6156 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
6160 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
6162 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
6164 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
6166 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
6168 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
6172 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
6174 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.";
6176 std::vector<int> stdvecTyyppArr;
6177 std::pair<int, std::pair<int,int> > sTyyppArr;
6178 MEDCoupling::DataArrayInt *daIntTyypp=0;
6179 int nbOfCompo=self->getNumberOfComponents();
6180 int nbOfTuples=self->getNumberOfTuples();
6181 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
6183 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
6184 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
6193 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
6199 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6200 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6203 //value vector<string>
6206 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6207 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6210 //value DataArrayChar
6213 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6217 throw INTERP_KERNEL::Exception(msg);
6221 {//obj list-tuple[int]
6227 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6233 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6234 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6237 //value vector<string>
6240 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6241 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6244 //value DataArrayChar
6247 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6251 throw INTERP_KERNEL::Exception(msg);
6262 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6268 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6269 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6272 //value vector<string>
6275 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6276 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6279 //value DataArrayChar
6282 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6286 throw INTERP_KERNEL::Exception(msg);
6297 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6303 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6304 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6307 //value vector<string>
6310 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6311 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6314 //value DataArrayChar
6317 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6321 throw INTERP_KERNEL::Exception(msg);
6326 throw INTERP_KERNEL::Exception(msg);
6332 class DataArrayAsciiCharTuple;
6334 class DataArrayAsciiCharIterator
6337 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6338 ~DataArrayAsciiCharIterator();
6343 DataArrayAsciiCharTuple *ret=self->nextt();
6345 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6348 PyErr_SetString(PyExc_StopIteration,"No more data.");
6355 class DataArrayAsciiCharTuple
6358 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6359 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6362 std::string __str__() const throw(INTERP_KERNEL::Exception)
6364 return self->repr();
6367 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6369 return self->buildDAAsciiChar(1,self->getNumberOfCompo());