Salome HOME
Merge branch 'master' of ssh://git.salome-platform.org/tools/medcoupling
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingMemArray.i
index 1ab220f00da5b345231410798177552b513f9be7..397712f5d8666b668385c02c562585be7fbccc94 100644 (file)
@@ -1,4 +1,4 @@
-// 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
@@ -43,6 +43,7 @@
 //$$$$$$$$$$$$$$$$$$
 
 %newobject MEDCoupling::DataArray::deepCopy;
+%newobject MEDCoupling::DataArray::buildNewEmptyInstance;
 %newobject MEDCoupling::DataArray::selectByTupleRanges;
 %newobject MEDCoupling::DataArray::selectByTupleId;
 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
@@ -50,6 +51,7 @@
 %newobject MEDCoupling::DataArray::Aggregate;
 %newobject MEDCoupling::DataArrayInt::New;
 %newobject MEDCoupling::DataArrayInt::__iter__;
+%newobject MEDCoupling::DataArrayInt::selectPartDef;
 %newobject MEDCoupling::DataArrayInt::convertToDblArr;
 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
 %newobject MEDCoupling::DataArrayInt::subArray;
@@ -85,6 +87,7 @@
 %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::selectPartDef;
 %newobject MEDCoupling::DataArrayDouble::convertToIntArr;
 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
 %newobject MEDCoupling::DataArrayDouble::Aggregate;
 %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::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
@@ -211,6 +233,109 @@ namespace MEDCoupling
       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:
@@ -240,8 +365,12 @@ namespace MEDCoupling
     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);
@@ -532,6 +661,7 @@ namespace MEDCoupling
     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);
@@ -589,6 +719,9 @@ namespace MEDCoupling
     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);
@@ -744,6 +877,12 @@ namespace MEDCoupling
           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();
+      }
+
       void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
       {
         double val;
@@ -867,6 +1006,47 @@ namespace MEDCoupling
         return convertDblArrToPyListOfTuple(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(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;
@@ -1063,6 +1243,16 @@ namespace MEDCoupling
         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)
       {
@@ -2224,35 +2414,7 @@ namespace MEDCoupling
       // 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;
+        return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
       }
 
       PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
@@ -2587,6 +2749,7 @@ namespace MEDCoupling
     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);
@@ -2615,6 +2778,7 @@ namespace MEDCoupling
     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);
@@ -2842,6 +3006,12 @@ namespace MEDCoupling
       {
         return self->iterator();
       }
+
+      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)
       {
@@ -2928,14 +3098,14 @@ namespace MEDCoupling
         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)
@@ -3094,8 +3264,7 @@ namespace MEDCoupling
             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 ));
@@ -3215,6 +3384,16 @@ namespace MEDCoupling
         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();
@@ -4582,35 +4761,7 @@ namespace MEDCoupling
       // 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;
+        return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
       }
       
       PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
@@ -4969,10 +5120,11 @@ namespace MEDCoupling
     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);
@@ -5213,6 +5365,12 @@ namespace MEDCoupling
                 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);
       }
@@ -5383,6 +5541,38 @@ namespace MEDCoupling
             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
+
+      // serialization
+      static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
+      {
+        return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
+      }
+
+      PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
+      {
+#ifdef WITH_NUMPY
+        if(!self->isAllocated())
+          throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
+        PyObject *ret(PyTuple_New(1));
+        PyObject *ret0(PyDict_New());
+        PyObject *numpyArryObj(MEDCoupling_DataArrayByte_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 DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
+#endif
+      }
 
       DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
       {