%newobject MEDCoupling::DataArray::selectByTupleIdSafe;
%newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
%newobject MEDCoupling::DataArray::Aggregate;
+%newobject MEDCoupling::DataArrayFloat::New;
%newobject MEDCoupling::DataArrayInt::New;
%newobject MEDCoupling::DataArrayInt::__iter__;
+%newobject MEDCoupling::DataArrayInt::selectPartDef;
%newobject MEDCoupling::DataArrayInt::convertToDblArr;
%newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
%newobject MEDCoupling::DataArrayInt::subArray;
%newobject MEDCoupling::DataArrayInt::BuildUnion;
%newobject MEDCoupling::DataArrayInt::BuildIntersection;
%newobject MEDCoupling::DataArrayInt::Range;
+%newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
%newobject MEDCoupling::DataArrayInt::fromNoInterlace;
%newobject MEDCoupling::DataArrayInt::toNoInterlace;
%newobject MEDCoupling::DataArrayInt::buildComplement;
%newobject MEDCoupling::DataArrayInt::buildIntersection;
%newobject MEDCoupling::DataArrayInt::buildUnique;
%newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
+%newobject MEDCoupling::DataArrayInt::fromLinkedListOfPairToList;
+%newobject MEDCoupling::DataArrayInt::findIdsGreaterOrEqualTo;
+%newobject MEDCoupling::DataArrayInt::findIdsGreaterThan;
+%newobject MEDCoupling::DataArrayInt::findIdsLowerOrEqualTo;
+%newobject MEDCoupling::DataArrayInt::findIdsLowerThan;
%newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
%newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
%newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
%newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
%newobject MEDCoupling::DataArrayDouble::New;
%newobject MEDCoupling::DataArrayDouble::__iter__;
+%newobject MEDCoupling::DataArrayDouble::selectPartDef;
%newobject MEDCoupling::DataArrayDouble::convertToIntArr;
%newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
%newobject MEDCoupling::DataArrayDouble::Aggregate;
%newobject MEDCoupling::DataArrayDouble::subArray;
%newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
%newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
+%newobject MEDCoupling::DataArrayDouble::cumSum;
%newobject MEDCoupling::DataArrayDouble::findIdsInRange;
%newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
%newobject MEDCoupling::DataArrayDouble::negate;
%newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
%newobject MEDCoupling::DataArrayDouble::fromCylToCart;
%newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
+%newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
+%newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
+%newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
+%newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
%newobject MEDCoupling::DataArrayDouble::cartesianize;
%newobject MEDCoupling::DataArrayDouble::getDifferentValues;
%newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
%newobject MEDCoupling::DataArrayDouble::__rpow__;
%newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
+%newobject MEDCoupling::PartDefinition::New;
+%newobject MEDCoupling::PartDefinition::toDAI;
+%newobject MEDCoupling::PartDefinition::__add__;
+%newobject MEDCoupling::PartDefinition::composeWith;
+%newobject MEDCoupling::PartDefinition::tryToSimplify;
+%newobject MEDCoupling::DataArrayPartDefinition::New;
+%newobject MEDCoupling::SlicePartDefinition::New;
+
+
%feature("unref") DataArray "$this->decrRef();"
%feature("unref") DataArrayDouble "$this->decrRef();"
%feature("unref") DataArrayInt "$this->decrRef();"
%feature("unref") DataArrayAsciiChar "$this->decrRef();"
%feature("unref") DataArrayByte "$this->decrRef();"
+%feature("unref") PartDefinition "$this->decrRef();"
+%feature("unref") DataArrayPartDefinition "$this->decrRef();"
+%feature("unref") SlicePartDefinition "$this->decrRef();"
+
namespace MEDCoupling
{
typedef enum
AX_SPHER = 5
} MEDCouplingAxisType;
+ class DataArrayInt;
+
+ class PartDefinition : public RefCountObject, public TimeLabel
+ {
+ public:
+ static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
+ static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
+ virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
+ virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
+ virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
+ virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
+ virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
+ virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
+ {
+ return (*self)+other;
+ }
+
+ virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
+ {
+ std::string ret1;
+ bool ret0(self->isEqual(other,ret1));
+ PyObject *ret=PyTuple_New(2);
+ PyObject *ret0Py=ret0?Py_True:Py_False;
+ Py_XINCREF(ret0Py);
+ PyTuple_SetItem(ret,0,ret0Py);
+ PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
+ return ret;
+ }
+
+ virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
+ {
+ return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
+ }
+ }
+ protected:
+ virtual ~PartDefinition();
+ };
+
+ class DataArrayPartDefinition : public PartDefinition
+ {
+ public:
+ static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayPartDefinition::New(listOfIds);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->getRepr();
+ }
+
+ std::string __repr__() const throw(INTERP_KERNEL::Exception)
+ {
+ std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
+ oss << self->getRepr();
+ return oss.str();
+ }
+ }
+ protected:
+ virtual ~DataArrayPartDefinition();
+ };
+
+ class SlicePartDefinition : public PartDefinition
+ {
+ public:
+ static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
+ int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
+ {
+ return SlicePartDefinition::New(start,stop,step);
+ }
+
+ PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
+ {
+ int a,b,c;
+ self->getSlice(a,b,c);
+ return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->getRepr();
+ }
+
+ std::string __repr__() const throw(INTERP_KERNEL::Exception)
+ {
+ std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
+ oss << self->getRepr();
+ return oss.str();
+ }
+ }
+ protected:
+ virtual ~SlicePartDefinition();
+ };
+
class DataArray : public RefCountObject, public TimeLabel
{
public:
virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
+ virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
+ virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
+ virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
}
}
};
+
+ class DataArrayFloat : public DataArray
+ {
+ public:
+ static DataArrayFloat *New();
+ void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
+ bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
+ bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
+ bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
+ void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
+ void iota(float init=0.) throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ DataArrayFloat() throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayFloat::New();
+ }
+
+ static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
+ }
+
+ DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
+ }
+
+ std::string __repr__() const throw(INTERP_KERNEL::Exception)
+ {
+ std::ostringstream oss;
+ self->reprQuickOverview(oss);
+ return oss.str();
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->reprNotTooLong();
+ }
+
+ int __len__() const throw(INTERP_KERNEL::Exception)
+ {
+ if(self->isAllocated())
+ {
+ return self->getNumberOfTuples();
+ }
+ else
+ {
+ throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
+ }
+ }
+
+ PyObject *getValues() const throw(INTERP_KERNEL::Exception)
+ {
+ const float *vals(self->begin());
+ return convertDblArrToPyList<float>(vals,self->getNbOfElems());
+ }
+
+ PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
+ {
+ const float *vals(self->begin());
+ int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
+ return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
+ }
+
+ PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayT__getitem<float>(self,obj);
+ }
+
+ DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayT__setitem__<float>(self,obj,value);
+ }
+
+#ifdef WITH_NUMPY
+ PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
+ {
+ return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
+ }
+#endif
+
+ }
+ };
class DataArrayInt;
class DataArrayDoubleIterator;
DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
%extend
{
DataArrayDouble() throw(INTERP_KERNEL::Exception)
- {
- return DataArrayDouble::New();
- }
+ {
+ return DataArrayDouble::New();
+ }
static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
{
- 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)";
- std::string msg(msgBase);
-#ifdef WITH_NUMPY
- msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
-#endif
- msg+=" !";
- if(PyList_Check(elt0) || PyTuple_Check(elt0))
- {
- if(nbOfTuples)
- {
- if(PyInt_Check(nbOfTuples))
- {
- int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
- if(nbOfTuples1<0)
- throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
- if(elt2)
- {
- if(PyInt_Check(elt2))
- {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
- int nbOfCompo=PyInt_AS_LONG(elt2);
- if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
- MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
- ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
- return ret.retn();
- }
- else
- throw INTERP_KERNEL::Exception(msg.c_str());
- }
- else
- {//DataArrayDouble.New([1.,3.,4.],3)
- MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- int tmpp1=-1;
- std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
- ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
- return ret.retn();
- }
- }
- else
- throw INTERP_KERNEL::Exception(msg.c_str());
- }
- else
- {// DataArrayDouble.New([1.,3.,4.])
- MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- int tmpp1=-1,tmpp2=-1;
- std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
- ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
- return ret.retn();
- }
- }
- else if(PyInt_Check(elt0))
- {
- int nbOfTuples1=PyInt_AS_LONG(elt0);
- if(nbOfTuples1<0)
- throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
- if(nbOfTuples)
- {
- if(!elt2)
- {
- if(PyInt_Check(nbOfTuples))
- {//DataArrayDouble.New(5,2)
- int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
- if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
- MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- ret->alloc(nbOfTuples1,nbOfCompo);
- return ret.retn();
- }
- else
- throw INTERP_KERNEL::Exception(msg.c_str());
- }
- else
- throw INTERP_KERNEL::Exception(msg.c_str());
- }
- else
- {//DataArrayDouble.New(5)
- MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- ret->alloc(nbOfTuples1,1);
- return ret.retn();
- }
- }
-#ifdef WITH_NUMPY
- else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
- {//DataArrayDouble.New(numpyArray)
- return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
- }
-#endif
- else
- throw INTERP_KERNEL::Exception(msg.c_str());
- throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
+ return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
}
DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
- {
- return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
- }
+ {
+ return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
+ }
+
+ DataArrayDouble *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<DataArrayDouble> ret(self->selectPartDef(pd));
+ return ret.retn();
+ }
+
+ DataArrayDouble *cumSum() const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<DataArrayDouble> ret(self->cumSum());
+ return ret.retn();
+ }
void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
{
PyObject *getValues() const throw(INTERP_KERNEL::Exception)
{
- const double *vals=self->getConstPointer();
- return convertDblArrToPyList(vals,self->getNbOfElems());
+ const double *vals(self->begin());
+ return convertDblArrToPyList<double>(vals,self->getNbOfElems());
}
#ifdef WITH_NUMPY
PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
{
- const double *vals=self->getConstPointer();
- int nbOfComp=self->getNumberOfComponents();
- int nbOfTuples=self->getNumberOfTuples();
- return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
+ const double *vals(self->begin());
+ int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
+ return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
}
DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
double res[9];
DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
- return convertDblArrToPyListOfTuple(res,3,3);
+ return convertDblArrToPyListOfTuple<double>(res,3,3);
+ }
+
+ DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
+ {
+ const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
+ double val,val2;
+ DataArrayDouble *a,*a2;
+ DataArrayDoubleTuple *aa,*aa2;
+ std::vector<double> bb,bb2;
+ int sw;
+ const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
+ const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
+ return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
}
DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
}
}
- DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumberR(tmp);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- int size=self->getNumberOfTuples();
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumberR(da2->getConstPointer());
- }
- }
-
- DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumberAndReduce(tmp,newNbOfTuple);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- int size=self->getNumberOfTuples();
- if(size!=self->getNumberOfTuples())
- {
- throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
- }
- return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
- }
- }
-
- PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
- {
- int thisTupleId,otherTupleId;
- double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
- PyObject *ret=PyTuple_New(3);
- PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
- PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
- PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
- return ret;
- }
-
- PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
- {
- int tmp;
- double r1=self->getMaxValue(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
- return ret;
- }
-
- PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *tmp;
- double r1=self->getMaxValue2(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
- {
- int tmp;
- double r1=self->getMinValue(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
- return ret;
- }
-
- PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *tmp;
- double r1=self->getMinValue2(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
- {
- int nbOfCompo=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
- self->getMinMaxPerComponent(tmp);
- PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
- return ret;
- }
-
- PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
- {
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
- self->accumulate(tmp);
- return convertDblArrToPyList(tmp,sz);
- }
-
- DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
- {
- int sw,sz,val;
- std::vector<int> val2;
- const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
- return self->accumulatePerChunck(bg,bg+sz);
- }
-
- PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *comm, *commIndex;
- self->findCommonTuples(prec,limitNodeId,comm,commIndex);
- PyObject *res = PyList_New(2);
- PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return res;
- }
-
- PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
- {
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
- const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
- //
- double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
- PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
- return ret;
- }
-
- void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> tmp;
- convertPyToNewIntArr3(li,tmp);
- self->setSelectedComponents(a,tmp);
- }
-
- PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
- {
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
- self->getTuple(tupleId,tmp);
- return convertDblArrToPyList(tmp,sz);
- }
-
- static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayDouble *> tmp;
- convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
- return DataArrayDouble::Aggregate(tmp);
- }
-
- static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayDouble *> tmp;
- convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
- return DataArrayDouble::Meld(tmp);
- }
-
- PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
- {
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- int nbComp=self->getNumberOfComponents(),nbTuples=-1;
- const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
- const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
- MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
- DataArrayInt *c=0,*cI=0;
- self->computeTupleIdsNearTuples(inpu,eps,c,cI);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *ret1=0;
- bool ret0=self->areIncludedInMe(other,prec,ret1);
- PyObject *ret=PyTuple_New(2);
- PyObject *ret0Py=ret0?Py_True:Py_False;
- Py_XINCREF(ret0Py);
- PyTuple_SetItem(ret,0,ret0Py);
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
- const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
- self->checkAllocated();
- int nbOfTuples=self->getNumberOfTuples();
- int nbOfComponents=self->getNumberOfComponents();
- int it1,ic1;
- std::vector<int> vt1,vc1;
- std::pair<int, std::pair<int,int> > pt1,pc1;
- DataArrayInt *dt1=0,*dc1=0;
- int sw;
- convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
- MCAuto<DataArrayDouble> ret;
- switch(sw)
- {
- case 1:
- if(nbOfComponents==1)
- return PyFloat_FromDouble(self->getIJSafe(it1,0));
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- case 2:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- case 3:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- case 4:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- case 5:
- return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
- case 6:
- {
- ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- std::vector<int> v2(1,ic1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 7:
- {
- ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
- std::vector<int> v2(1,ic1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 8:
- {
- ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- std::vector<int> v2(1,ic1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 9:
- {
- ret=self->selectByTupleIdSafe(&it1,&it1+1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 10:
- {
- ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 11:
- {
- ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 12:
- {
- ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 13:
- {
- ret=self->selectByTupleIdSafe(&it1,&it1+1);
- int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
- v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 14:
- {
- ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
- v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 15:
- {
- ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
- int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
- v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 16:
- {
- ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
- v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
- {
- self->checkAllocated();
- const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
- int nbOfTuples=self->getNumberOfTuples();
- int nbOfComponents=self->getNumberOfComponents();
- int sw1,sw2;
- double i1;
- std::vector<double> v1;
- DataArrayDouble *d1=0;
- convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
- int it1,ic1;
- std::vector<int> vt1,vc1;
- std::pair<int, std::pair<int,int> > pt1,pc1;
- DataArrayInt *dt1=0,*dc1=0;
- convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
- MCAuto<DataArrayDouble> tmp;
- switch(sw2)
- {
- case 1:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 2:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 3:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 4:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 5:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 6:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 7:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 8:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 9:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 10:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 11:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 12:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 13:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 14:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 15:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 16:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
+ DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberR(tmp);
}
- return self;
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ int size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberR(da2->getConstPointer());
+ }
+ }
+
+ DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberAndReduce(tmp,newNbOfTuple);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ int size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
+ }
+ }
+
+ PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
+ {
+ int thisTupleId,otherTupleId;
+ double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
+ PyObject *ret=PyTuple_New(3);
+ PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
+ PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
+ return ret;
+ }
+
+ PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
+ {
+ int tmp;
+ double r1=self->getMaxValue(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
+ return ret;
+ }
+
+ PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *tmp;
+ double r1=self->getMaxValue2(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
+ {
+ int tmp;
+ double r1=self->getMinValue(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
+ return ret;
+ }
+
+ PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *tmp;
+ double r1=self->getMinValue2(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
+ {
+ int nbOfCompo(self->getNumberOfComponents());
+ INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
+ self->getMinMaxPerComponent(tmp);
+ PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
+ return ret;
+ }
+
+ PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
+ self->accumulate(tmp);
+ return convertDblArrToPyList<double>(tmp,sz);
+ }
+
+ DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
+ {
+ int sw,sz,val;
+ std::vector<int> val2;
+ const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
+ return self->accumulatePerChunck(bg,bg+sz);
+ }
+
+ PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *comm, *commIndex;
+ self->findCommonTuples(prec,limitNodeId,comm,commIndex);
+ PyObject *res = PyList_New(2);
+ PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return res;
+ }
+
+ PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
+ {
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
+ const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
+ //
+ double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
+ return ret;
+ }
+
+ void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> tmp;
+ convertPyToNewIntArr3(li,tmp);
+ self->setSelectedComponents(a,tmp);
+ }
+
+ PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
+ std::size_t sz(retCpp.size());
+ PyObject *res(PyList_New(sz));
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+ return res;
+ }
+
+ PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
+ {
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
+ self->getTuple(tupleId,tmp);
+ return convertDblArrToPyList<double>(tmp,sz);
+ }
+
+ static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<const DataArrayDouble *> tmp;
+ convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
+ return DataArrayDouble::Aggregate(tmp);
+ }
+
+ static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<const DataArrayDouble *> tmp;
+ convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
+ return DataArrayDouble::Meld(tmp);
+ }
+
+ PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
+ {
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ int nbComp=self->getNumberOfComponents(),nbTuples=-1;
+ const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
+ const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
+ MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
+ DataArrayInt *c=0,*cI=0;
+ self->computeTupleIdsNearTuples(inpu,eps,c,cI);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ bool ret0=self->areIncludedInMe(other,prec,ret1);
+ PyObject *ret=PyTuple_New(2);
+ PyObject *ret0Py=ret0?Py_True:Py_False;
+ Py_XINCREF(ret0Py);
+ PyTuple_SetItem(ret,0,ret0Py);
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayT__getitem<double>(self,obj);
+ }
+
+ DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayT__setitem__<double>(self,obj,value);
}
DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
{
return self->iterator();
}
+
+ DataArrayInt *fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<DataArrayInt> ret(self->fromLinkedListOfPairToList());
+ return ret.retn();
+ }
+
+ DataArrayInt *findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<DataArrayInt> ret(self->findIdsGreaterOrEqualTo(val));
+ return ret.retn();
+ }
+
+ DataArrayInt *findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<DataArrayInt> ret(self->findIdsGreaterThan(val));
+ return ret.retn();
+ }
+
+ DataArrayInt *findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<DataArrayInt> ret(self->findIdsLowerOrEqualTo(val));
+ return ret.retn();
+ }
+
+ DataArrayInt *findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<DataArrayInt> ret(self->findIdsLowerThan(val));
+ return ret.retn();
+ }
+
+ DataArrayInt *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<DataArrayInt> ret(self->selectPartDef(pd));
+ return ret.retn();
+ }
PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
{
self->setSelectedComponents(a,tmp);
}
+ PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
+ std::size_t sz(retCpp.size());
+ PyObject *res(PyList_New(sz));
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return res;
+ }
+
PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
{
int sz=self->getNumberOfComponents();