-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
////////////////////
%typemap(out) MEDCoupling::DataArray*
{
$result=convertDataArrayChar($1,$owner);
}
+
+%typemap(out) MCAuto<MEDCoupling::DataArrayInt>
+{
+ $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN|0);
+}
+
+%typemap(out) MCAuto<MEDCoupling::DataArrayDouble>
+{
+ $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN|0);
+}
+
+%typemap(out) MCAuto<MEDCoupling::DataArrayFloat>
+{
+ $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayFloat,SWIG_POINTER_OWN|0);
+}
+
+%typemap(out) MCAuto<MEDCoupling::MapII>
+{
+ $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__MapII,SWIG_POINTER_OWN|0);
+}
//$$$$$$$$$$$$$$$$$$
%newobject MEDCoupling::DataArray::deepCopy;
+%newobject MEDCoupling::DataArray::buildNewEmptyInstance;
%newobject MEDCoupling::DataArray::selectByTupleRanges;
%newobject MEDCoupling::DataArray::selectByTupleId;
%newobject MEDCoupling::DataArray::selectByTupleIdSafe;
%newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
%newobject MEDCoupling::DataArray::Aggregate;
+%newobject MEDCoupling::DataArrayFloat::New;
+%newobject MEDCoupling::DataArrayFloat::iterator;
+%newobject MEDCoupling::DataArrayFloat::__iter__;
+%newobject MEDCoupling::DataArrayFloat::Meld;
+%newobject MEDCoupling::DataArrayFloat::__rmul__;
%newobject MEDCoupling::DataArrayInt::New;
%newobject MEDCoupling::DataArrayInt::__iter__;
-%newobject MEDCoupling::DataArrayInt::convertToDblArr;
%newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
%newobject MEDCoupling::DataArrayInt::subArray;
%newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
%newobject MEDCoupling::DataArrayInt::findIdsEqualList;
%newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
%newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
+%newobject MEDCoupling::DataArrayInt::findIdForEach;
%newobject MEDCoupling::DataArrayInt::sumPerTuple;
%newobject MEDCoupling::DataArrayInt::negate;
%newobject MEDCoupling::DataArrayInt::computeAbs;
%newobject MEDCoupling::DataArrayInt::findIdsInRange;
%newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
-%newobject MEDCoupling::DataArrayInt::findIdsStricltyNegative;
+%newobject MEDCoupling::DataArrayInt::findIdsStrictlyNegative;
%newobject MEDCoupling::DataArrayInt::Aggregate;
%newobject MEDCoupling::DataArrayInt::AggregateIndexes;
%newobject MEDCoupling::DataArrayInt::Meld;
%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::DataArrayAsciiCharTuple::buildDAAsciiChar;
%newobject MEDCoupling::DataArrayDouble::New;
%newobject MEDCoupling::DataArrayDouble::__iter__;
-%newobject MEDCoupling::DataArrayDouble::convertToIntArr;
%newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
%newobject MEDCoupling::DataArrayDouble::Aggregate;
%newobject MEDCoupling::DataArrayDouble::Meld;
%newobject MEDCoupling::DataArrayDouble::Multiply;
%newobject MEDCoupling::DataArrayDouble::Divide;
%newobject MEDCoupling::DataArrayDouble::Pow;
+%newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
%newobject MEDCoupling::DataArrayDouble::subArray;
%newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
%newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
%newobject MEDCoupling::DataArrayDouble::findIdsInRange;
%newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
+%newobject MEDCoupling::DataArrayDouble::findIdsStrictlyNegative;
%newobject MEDCoupling::DataArrayDouble::negate;
%newobject MEDCoupling::DataArrayDouble::computeAbs;
%newobject MEDCoupling::DataArrayDouble::applyFunc;
%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") MapII "$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 MapII : public RefCountObject, public TimeLabel
+ {
+ public:
+ static MCAuto< MapII > New();
+ };
+
+ 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 std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
+ 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);
if(!PySlice_Check(slic))
throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
- PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
- GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
+ GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
int a,b;
DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
if(!PySlice_Check(slic))
throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
- PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
- GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
+ GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
int a,b;
DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
if(!PySlice_Check(slic))
throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
- PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
- GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
+ GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
}
if(!PySlice_Check(slic))
throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
- PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
- GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
+ GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
}
if(!PySlice_Check(slic))
throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
- PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
- GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
+ GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
}
if(!PySlice_Check(slic))
throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
- PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
- GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
+ GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
}
if(sz!=2)
throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
PyObject *a0(PyTuple_GetItem(inp,0));
- if(!PyString_Check(a0))
- throw INTERP_KERNEL::Exception(MSG);
+ self->setName(convertPyObjectToStr(a0,MSG));
PyObject *a1(PyTuple_GetItem(inp,1));
std::vector<std::string> a1cpp;
if(!fillStringVector(a1,a1cpp))
throw INTERP_KERNEL::Exception(MSG);
- self->setName(PyString_AsString(a0));
self->setInfoOnComponents(a1cpp);
}
}
};
+
+ class DataArrayDouble;
+
+ 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);
+ DataArrayFloatIterator *iterator() throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
+ static DataArrayFloat *Meld(const DataArrayFloat *a1, const DataArrayFloat *a2) 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);
+ }
+
+ DataArrayFloatIterator *__iter__() throw(INTERP_KERNEL::Exception)
+ {
+ return self->iterator();
+ }
+
+ 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 *isEqualIfNotWhy(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception)
+ {
+ std::string ret1;
+ bool ret0=self->isEqualIfNotWhy(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,PyString_FromString(ret1.c_str()));
+ return ret;
+ }
+
+ 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);
+ }
+
+ PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayT_iadd<float>(trueSelf,obj,self);
+ }
+
+ PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayT_isub<float>(trueSelf,obj,self);
+ }
+
+ PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayT_imul<float>(trueSelf,obj,self);
+ }
+
+ DataArrayFloat *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayFPT_rmul<float>(self,obj);
+ }
+
+ PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayT_idiv<float>(trueSelf,obj,self);
+ }
+
+#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 DataArrayFloatTuple;
+
+ class DataArrayFloatIterator
+ {
+ public:
+ DataArrayFloatIterator(DataArrayFloat *da);
+ ~DataArrayFloatIterator();
+ %extend
+ {
+ PyObject *next()
+ {
+ DataArrayFloatTuple *ret=self->nextt();
+ if(ret)
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple,SWIG_POINTER_OWN|0);
+ else
+ {
+ PyErr_SetString(PyExc_StopIteration,"No more data.");
+ return 0;
+ }
+ }
+ }
+ };
+
+ class DataArrayFloatTuple
+ {
+ public:
+ int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
+ DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->repr();
+ }
+
+ float __float__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->floatValue();
+ }
+
+ DataArrayFloat *buildDAFloat() throw(INTERP_KERNEL::Exception)
+ {
+ return self->buildDAFloat(1,self->getNumberOfCompo());
+ }
+
+ /*PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
+ MEDCoupling_DataArrayFloat____imul___(ret,0,obj);
+ Py_XINCREF(trueSelf);
+ return trueSelf;
+ }*/
+
+ PyObject *__len__() throw(INTERP_KERNEL::Exception)
+ {
+ return PyInt_FromLong(self->getNumberOfCompo());
+ }
+ }
+ };
class DataArrayInt;
class DataArrayDoubleIterator;
static DataArrayDouble *New();
double doubleValue() const throw(INTERP_KERNEL::Exception);
bool empty() const throw(INTERP_KERNEL::Exception);
+ void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
- double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
- double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
+ double getMaxAbsValueInArray() const throw(INTERP_KERNEL::Exception);
double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
double getAverageValue() const throw(INTERP_KERNEL::Exception);
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);
void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayInt> findIdsGreaterThan(double val) const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayInt> findIdsLowerOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayInt> findIdsLowerThan(double val) const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayInt> convertToIntArr() const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayDouble> cumSum() const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayFloat> convertToFloatArr() 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);
+ }
void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
{
}
}
+ PyObject *asArcOfCircle() const throw(INTERP_KERNEL::Exception)
+ {
+ double center[2],radius,ang;
+ self->asArcOfCircle(center,radius,ang);
+ PyObject *ret(PyTuple_New(3));
+ {
+ PyObject *ret0(PyList_New(2));
+ PyList_SetItem(ret0,0,PyFloat_FromDouble(center[0]));
+ PyList_SetItem(ret0,1,PyFloat_FromDouble(center[1]));
+ PyTuple_SetItem(ret,0,ret0);
+ }
+ PyTuple_SetItem(ret,1,PyFloat_FromDouble(radius));
+ PyTuple_SetItem(ret,2,PyFloat_FromDouble(ang));
+ return ret;
+ }
+
DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
{
return self->iterator();
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 char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
+ double val,val2;
+ DataArrayDouble *a,*a2;
+ DataArrayDoubleTuple *aa,*aa2;
+ std::vector<double> bb,bb2;
+ int sw;
+ const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
+ const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
+ MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
+ return ret.retn();
+ }
+
+ static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
+ {
+ const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
+ double val,val2;
+ DataArrayDouble *a,*a2;
+ DataArrayDoubleTuple *aa,*aa2;
+ std::vector<double> bb,bb2;
+ int sw;
+ const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
+ double res[9];
+ DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
+ 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)
{
void *da=0;
return ret;
}
+ PyObject *getMaxAbsValue() const throw(INTERP_KERNEL::Exception)
+ {
+ std::size_t tmp;
+ double r1=self->getMaxAbsValue(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;
PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
{
- int nbOfCompo=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
+ int nbOfCompo(self->getNumberOfComponents());
+ INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
self->getMinMaxPerComponent(tmp);
- PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
+ PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
return ret;
}
int sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->accumulate(tmp);
- return convertDblArrToPyList(tmp,sz);
+ 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);
+ const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
return self->accumulatePerChunck(bg,bg+sz);
}
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(tmp,sz);
+ return convertDblArrToPyList<double>(tmp,sz);
}
static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
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;
+ 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)
+ {
+ return self->negate();
+ }
+
+ PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
int sw;
- convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
- MCAuto<DataArrayDouble> ret;
+ //
+#ifndef WITHOUT_AUTOFIELD
+ void *argp;
+ if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
+ {
+ MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
+ if(other)
+ {
+ PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
+ Py_XDECREF(tmp);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+#endif
+ //
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
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 );
+ MCAuto<DataArrayDouble> ret=self->deepCopy();
+ ret->applyLin(1.,val);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
- case 14:
+ case 2:
{
- 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 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
- case 15:
+ case 3:
{
- 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 );
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
- case 16:
+ case 4:
{
- 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 );
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
default:
throw INTERP_KERNEL::Exception(msg);
}
}
- DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
+ DataArrayDouble *__radd__(PyObject *obj) 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)
+ const char msg[]="Unexpected situation in __radd__ !";
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
+ switch(sw)
{
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);
- }
- return self;
- }
-
- DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
- {
- return self->negate();
- }
-
- PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- //
-#ifndef WITHOUT_AUTOFIELD
- void *argp;
- if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
- {
- MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
- if(other)
- {
- PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
- MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
- Py_XDECREF(tmp);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
-#endif
- //
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayDouble> ret=self->deepCopy();
- ret->applyLin(1.,val);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 2:
- {
- return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __radd__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayDouble> ret=self->deepCopy();
- ret->applyLin(1.,val);
- return ret.retn();
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Add(self,aaa);
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return DataArrayDouble::Add(self,aaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __iadd__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- self->applyLin(1.,val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- self->addEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
+ {
+ MCAuto<DataArrayDouble> ret=self->deepCopy();
+ ret->applyLin(1.,val);
+ return ret.retn();
}
case 3:
{
MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- self->addEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
+ return DataArrayDouble::Add(self,aaa);
}
case 4:
{
MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->addEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
+ return DataArrayDouble::Add(self,aaa);
}
default:
throw INTERP_KERNEL::Exception(msg);
}
}
+
+ PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayT_iadd<double>(trueSelf,obj,self);
+ }
PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
}
#endif
//
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
DataArrayDoubleTuple *aa;
std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- const char msg[]="Unexpected situation in __isub__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- self->applyLin(1,-val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- self->substractEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- self->substractEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->substractEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
+ return DataArrayT_isub<double>(trueSelf,obj,self);
}
PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
}
#endif
//
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- const char msg[]="Unexpected situation in __rmul__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayDouble> ret=self->deepCopy();
- ret->applyLin(val,0.);
- return ret.retn();
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Multiply(self,aaa);
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return DataArrayDouble::Multiply(self,aaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
+ return DataArrayFPT_rmul<double>(self,obj);
}
PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- const char msg[]="Unexpected situation in __imul__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- self->applyLin(val,0.);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- self->multiplyEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- self->multiplyEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->multiplyEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
+ return DataArrayT_imul<double>(trueSelf,obj,self);
}
PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
}
#endif
//
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
DataArrayDoubleTuple *aa;
std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- const char msg[]="Unexpected situation in __idiv__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- if(val==0.)
- throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
- self->applyLin(1./val,0.);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- self->divideEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- self->divideEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->divideEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
+ return DataArrayT_idiv<double>(trueSelf,obj,self);
}
DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
DataArrayDoubleTuple *aa;
std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
DataArrayDoubleTuple *aa;
std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
DataArrayDoubleTuple *aa;
std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+ convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return ret;
}
-
- // serialization
- static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
- {
- static const char MSG[]="DataArrayDouble.__new__ : the args in input is expected to be a tuple !";
- if(!PyTuple_Check(args))
- throw INTERP_KERNEL::Exception(MSG);
- PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
- PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
- PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
- //
- PyObject *tmp0(PyTuple_New(1));
- PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
- PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
- Py_DECREF(tmp0);
- Py_DECREF(selfMeth);
- PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
- int sz(PyTuple_Size(args));
-
- if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
- {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
- PyObject *zeNumpyRepr(0);
- PyObject *tmp1(PyInt_FromLong(0));
- zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
- Py_DECREF(tmp1);
- PyObject *tmp3(PyTuple_New(1));
- PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
- PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
- Py_XDECREF(tmp2);
- Py_DECREF(tmp3);
- }
- Py_DECREF(initMeth);
- return instance;
- }
-
- PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
- {
-#ifdef WITH_NUMPY
- if(!self->isAllocated())
- throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
- PyObject *ret(PyTuple_New(1));
- PyObject *ret0(PyDict_New());
- PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
- {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
- PyObject *tmp1(PyInt_FromLong(0));
- PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
- PyTuple_SetItem(ret,0,ret0);
- }
- return ret;
-#else
- throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
-#endif
- }
}
};
MEDCoupling::DataArrayInt *daIntTyypp=0;
const double *pt=self->getConstPointer();
int nbc=self->getNumberOfCompo();
- convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
std::vector<double> multiValV;
MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
int nbc=self->getNumberOfCompo();
- convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
+ convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
int singleVal;
std::vector<int> multiVal;
std::pair<int, std::pair<int,int> > slic;
MEDCoupling::DataArrayInt *daIntTyypp=0;
double *pt=self->getPointer();
- convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
switch(sw2)
{
case 1:
int intValue() const throw(INTERP_KERNEL::Exception);
int getHashCode() const throw(INTERP_KERNEL::Exception);
bool empty() const throw(INTERP_KERNEL::Exception);
+ void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) 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);
+ MCAuto< MapII > invertArrayN2O2O2NOptimized() 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);
DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
+ int checkUniformAndGuess() const throw(INTERP_KERNEL::Exception);
+ bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
void transpose() throw(INTERP_KERNEL::Exception);
DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
int count(int value) const throw(INTERP_KERNEL::Exception);
int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
- int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
- int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
+ int getMaxAbsValueInArray() const throw(INTERP_KERNEL::Exception);
int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
void abs() throw(INTERP_KERNEL::Exception);
DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
void applyRPow(int val) throw(INTERP_KERNEL::Exception);
DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
+ MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
public:
static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
%extend
{
return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
}
-
+
std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->reprNotTooLong();
{
int sw,sz,val;
std::vector<int> val2;
- const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
+ const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
return self->accumulatePerChunck(bg,bg+sz);
}
{
int sw,sz,val;
std::vector<int> val2;
- const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
+ const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
return self->findIdsEqualTuple(bg,bg+sz);
}
+ DataArrayInt *findIdForEach(PyObject *vals) const throw(INTERP_KERNEL::Exception)
+ {
+ int sw,sz,val;
+ std::vector<int> val2;
+ const int *bg(convertIntStarLikePyObjToCppIntStar(vals,sw,sz,val,val2));
+ MCAuto<DataArrayInt> ret(self->findIdForEach(bg,bg+sz));
+ return ret.retn();
+ }
+
PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
{
std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
if(!PySlice_Check(slic))
throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
- PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
- GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
+ GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
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 !");
return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
int newNbOfTuples=-1;
int szArr,szArrI,sw,iTypppArr,iTypppArrI;
std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
- const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
- const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
+ const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
MCAuto<DataArrayInt> ret(DataArrayInt::New());
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
+ const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
return ret.retn();
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 !";
if(PyList_Check(li) || PyTuple_Check(li))
{
- if(nbOfTuples)
+ if(nbOfTuples && nbOfTuples != Py_None)
{
if(PyInt_Check(nbOfTuples))
{
int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
if(nbOfTuples<0)
throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
- if(nbOfComp)
+ if(nbOfComp && nbOfComp != Py_None)
{
if(PyInt_Check(nbOfComp))
{//DataArrayInt.setValues([1,3,4,5],2,2)
void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 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);
- self->transformWithIndArr(tmp,tmp+size);
+ int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
+ if(SWIG_IsOK(res2))
+ {
+ MapII *m=reinterpret_cast<MapII *>(da);
+ self->transformWithIndArr(*m);
+ }
+ else
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ self->transformWithIndArr(tmp,tmp+size);
+ }
}
else
{
std::vector<int> multiVal;
std::pair<int, std::pair<int,int> > slic;
MEDCoupling::DataArrayInt *daIntTyypp=0;
- convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
std::vector<int> multiVal;
std::pair<int, std::pair<int,int> > slic;
MEDCoupling::DataArrayInt *daIntTyypp=0;
- convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
if(!da2)
throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
da2->checkAllocated();
- int size=self->getNumberOfTuples();
- self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
+ self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
}
PyObject *ret = PyList_New(3);
PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
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();
PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
return ret;
}
+
+ PyObject *getMaxAbsValue(std::size_t& tupleId) const throw(INTERP_KERNEL::Exception)
+ {
+ std::size_t tmp;
+ int r1=self->getMaxAbsValue(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
+ return ret;
+ }
PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
{
std::vector<int> v1;
DataArrayInt *d1=0;
DataArrayIntTuple *dd1=0;
- convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
+ convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
int it1,ic1;
std::vector<int> vt1,vc1;
std::pair<int, std::pair<int,int> > pt1,pc1;
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
std::vector<int> aa;
DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+ convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
{
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
self->pushBackValsSilent(tmp,tmp+szArr);
}
PyTuple_SetItem(pyRet,1,ret1Py);
return pyRet;
}
-
- // serialization
- static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
- {
- static const char MSG[]="DataArrayInt.__new__ : the args in input is expected to be a tuple !";
- if(!PyTuple_Check(args))
- throw INTERP_KERNEL::Exception(MSG);
- PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
- PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
- PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
- //
- PyObject *tmp0(PyTuple_New(1));
- PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
- PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
- Py_DECREF(tmp0);
- Py_DECREF(selfMeth);
- PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
- int sz(PyTuple_Size(args));
-
- if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
- {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
- PyObject *zeNumpyRepr(0);
- PyObject *tmp1(PyInt_FromLong(0));
- zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
- Py_DECREF(tmp1);
- PyObject *tmp3(PyTuple_New(1));
- PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
- PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
- Py_XDECREF(tmp2);
- Py_DECREF(tmp3);
- }
- Py_DECREF(initMeth);
- return instance;
- }
-
- PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
- {
-#ifdef WITH_NUMPY
- if(!self->isAllocated())
- throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
- PyObject *ret(PyTuple_New(1));
- PyObject *ret0(PyDict_New());
- PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
- {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
- PyObject *tmp1(PyInt_FromLong(0));
- PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
- PyTuple_SetItem(ret,0,ret0);
- }
- return ret;
-#else
- throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
-#endif
- }
}
};
Py_XINCREF(trueSelf);
return trueSelf;
}
-
PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
{
MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
MEDCoupling::DataArrayInt *daIntTyypp=0;
const int *pt=self->getConstPointer();
int nbc=self->getNumberOfCompo();
- convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
std::pair<int, std::pair<int,int> > slic;
MEDCoupling::DataArrayInt *daIntTyypp=0;
int *pt=self->getPointer();
- convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
switch(sw2)
{
case 1:
DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
+ void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
- void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
+ void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
char front() const throw(INTERP_KERNEL::Exception);
char back() const throw(INTERP_KERNEL::Exception);
void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
return ret.retn();
}
}
+#ifdef WITH_NUMPY
+ else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
+ {//DataArrayDouble.New(numpyArray)
+ return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
+ }
+#endif
else
throw INTERP_KERNEL::Exception(msg);
}
{
int sz=-1,sw=-1;
int ival=-1; std::vector<int> ivval;
- const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
+ const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
std::vector<char> vals(sz);
std::copy(pt,pt+sz,vals.begin());
return self->presenceOfTuple(vals);
{
int sz=-1,sw=-1;
int ival=-1; std::vector<int> ivval;
- const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
+ const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
std::vector<char> vals2(sz);
std::copy(pt,pt+sz,vals2.begin());
return self->presenceOfValue(vals2);
{
int sz=-1,sw=-1;
int ival=-1; std::vector<int> ivval;
- const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
+ const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
std::vector<char> vals2(sz);
std::copy(pt,pt+sz,vals2.begin());
return self->findIdFirstEqual(vals2);
{
int sz=-1,sw=-1;
int ival=-1; std::vector<int> ivval;
- const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
+ const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
std::vector<char> vals(sz);
std::copy(pt,pt+sz,vals.begin());
return self->findIdFirstEqualTuple(vals);
{
int sz=-1,sw=-1;
int ival=-1; std::vector<int> ivval;
- const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
+ const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
std::vector<char> vals(sz);
std::copy(pt,pt+sz,vals.begin());
return self->findIdSequence(vals);
return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
}
}
+
+#ifdef WITH_NUMPY
+ PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
+ {
+ return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
+ }
+#endif
DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
{
std::vector<int> v1;
DataArrayInt *d1=0;
DataArrayIntTuple *dd1=0;
- convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
+ convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
int it1,ic1;
std::vector<int> vt1,vc1;
std::pair<int, std::pair<int,int> > pt1,pc1;
else
throw INTERP_KERNEL::Exception(msg);
}
+%#if PY_VERSION_HEX >= 0x03000000
+ else if(PyUnicode_Check(nbOfTuples))
+ {
+ if(PyUnicode_GET_LENGTH(nbOfTuples)!=1)
+ throw INTERP_KERNEL::Exception(msg);
+ //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
+ std::vector<std::string> tmp;
+ if(fillStringVector(elt0,tmp))
+ return DataArrayAsciiChar::New(tmp,PyUnicode_AsUTF8(nbOfTuples)[0]);
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+%#endif
else
throw INTERP_KERNEL::Exception(msg);
}
std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
return self->presenceOfTuple(vals);
}
+%#if PY_VERSION_HEX >= 0x03000000
+ else if(PyUnicode_Check(tupl))
+ {
+ Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
+ std::vector<char> vals(sz);
+ std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
+ return self->presenceOfTuple(vals);
+ }
+%#endif
else
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
}
std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
return self->presenceOfValue(vals2);
}
+%#if PY_VERSION_HEX >= 0x03000000
+ if(PyUnicode_Check(vals))
+ {
+ Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
+ std::vector<char> vals2(sz);
+ std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
+ return self->presenceOfValue(vals2);
+ }
+%#endif
else
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
}
std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
return self->findIdFirstEqual(vals2);
}
+%#if PY_VERSION_HEX >= 0x03000000
+ if(PyUnicode_Check(vals))
+ {
+ Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
+ std::vector<char> vals2(sz);
+ std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
+ return self->findIdFirstEqual(vals2);
+ }
+%#endif
else
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
}
std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
return self->findIdFirstEqualTuple(vals);
}
+%#if PY_VERSION_HEX >= 0x03000000
+ if(PyUnicode_Check(tupl))
+ {
+ Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
+ std::vector<char> vals(sz);
+ std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
+ return self->findIdFirstEqualTuple(vals);
+ }
+%#endif
else
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
}
std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
return self->findIdSequence(vals);
}
+%#if PY_VERSION_HEX >= 0x03000000
+ else if(PyUnicode_Check(strOrListOfInt))
+ {
+ Py_ssize_t sz=PyUnicode_GET_LENGTH(strOrListOfInt);
+ std::vector<char> vals(sz);
+ std::copy(PyUnicode_AsUTF8(strOrListOfInt),PyUnicode_AsUTF8(strOrListOfInt)+sz,vals.begin());
+ return self->findIdSequence(vals);
+ }
+%#endif
else
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
}
else
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
}
+%#if PY_VERSION_HEX >= 0x03000000
+ if(PyUnicode_Check(obj))
+ {
+ Py_ssize_t sz;
+ char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
+ if(sz==1)
+ return self->findIdFirstEqual(pt[0]);
+ else
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
+ }
+%#endif
else
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
}
else
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
}
+%#if PY_VERSION_HEX >= 0x03000000
+ if(PyUnicode_Check(obj))
+ {
+ Py_ssize_t sz;
+ char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
+ if(sz==1)
+ return self->presenceOfValue(pt[0]);
+ else
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
+ }
+%#endif
else
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
}
std::vector<int> stdvecTyyppArr;
std::pair<int, std::pair<int,int> > sTyyppArr;
MEDCoupling::DataArrayInt *daIntTyypp=0;
- convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
switch(sw)
{
case 1:
MEDCoupling::DataArrayInt *daIntTyypp=0;
int nbOfCompo=self->getNumberOfComponents();
int nbOfTuples=self->getNumberOfTuples();
- convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
int sw2;
char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
}
};
}
+
+%pythoncode %{
+def MEDCouplingStdReduceFunct(cls,params):
+ a,b=params
+ ret=object.__new__(cls)
+ ret.__init__(*a)
+ ret.__setstate__(b)
+ return ret
+
+def MEDCouplingDataArrayDoubleReduce(self):
+ if not MEDCouplingHasNumPyBindings():
+ raise InterpKernelException("PyWrap of DataArrayDouble.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
+ return MEDCouplingStdReduceFunct,(DataArrayDouble,((self.toNumPyArray(),),(self.__getstate__()),))
+
+def MEDCouplingDataArrayIntReduce(self):
+ if not MEDCouplingHasNumPyBindings():
+ raise InterpKernelException("PyWrap of DataArrayInt.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
+ return MEDCouplingStdReduceFunct,(DataArrayInt,((self.toNumPyArray(),),(self.__getstate__()),))
+
+def MEDCouplingDataArrayByteReduce(self):
+ if not MEDCouplingHasNumPyBindings():
+ raise InterpKernelException("PyWrap of DataArrayByte.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
+ return MEDCouplingStdReduceFunct,(DataArrayByte,((self.toNumPyArray(),),(self.__getstate__()),))
+
+def MEDCouplingDataArrayFloatReduce(self):
+ if not MEDCouplingHasNumPyBindings():
+ raise InterpKernelException("PyWrap of DataArrayFloat.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
+ return MEDCouplingStdReduceFunct,(DataArrayFloat,((self.toNumPyArray(),),(self.__getstate__()),))
+%}