Salome HOME
Merge branch 'master' of ssh://git.salome-platform.org/tools/medcoupling
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingCommon.i
index 14a4510e5c76da6f58cf41540ef59373eb9df440..bad2f7127fe76d6cf77f03aea8db794bee8ef0e1 100644 (file)
@@ -212,6 +212,8 @@ using namespace INTERP_KERNEL;
 %newobject MEDCoupling::MEDCouplingFieldDouble::findIdsInRange;
 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPart;
 %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPartRange;
+%newobject MEDCoupling::MEDCouplingFieldDouble::voronoize;
+%newobject MEDCoupling::MEDCouplingFieldDouble::convertQuadraticCellsToLinear;
 %newobject MEDCoupling::MEDCouplingFieldDouble::__getitem__;
 %newobject MEDCoupling::MEDCouplingFieldDouble::__neg__;
 %newobject MEDCoupling::MEDCouplingFieldDouble::__add__;
@@ -313,6 +315,7 @@ using namespace INTERP_KERNEL;
 %newobject MEDCoupling::MEDCouplingUMesh::buildPartOrthogonalField;
 %newobject MEDCoupling::MEDCouplingUMesh::keepCellIdsByType;
 %newobject MEDCoupling::MEDCouplingUMesh::Build0DMeshFromCoords;
+%newobject MEDCoupling::MEDCouplingUMesh::Build1DMeshFromCoords;
 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
 %newobject MEDCoupling::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
 %newobject MEDCoupling::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
@@ -327,6 +330,7 @@ using namespace INTERP_KERNEL;
 %newobject MEDCoupling::MEDCouplingUMesh::buildUnionOf3DMesh;
 %newobject MEDCoupling::MEDCouplingUMesh::generateGraph;
 %newobject MEDCoupling::MEDCouplingUMesh::orderConsecutiveCells1D;
+%newobject MEDCoupling::MEDCouplingUMesh::clipSingle3DCellByPlane;
 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
 %newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
@@ -404,13 +408,8 @@ using namespace INTERP_KERNEL;
 %newobject MEDCoupling::DenseMatrix::__add__;
 %newobject MEDCoupling::DenseMatrix::__sub__;
 %newobject MEDCoupling::DenseMatrix::__mul__;
-%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;
+%newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell;
+%newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell;
 
 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
 %feature("unref") MEDCouplingMesh "$this->decrRef();"
@@ -441,9 +440,7 @@ using namespace INTERP_KERNEL;
 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
 %feature("unref") DenseMatrix "$this->decrRef();"
-%feature("unref") PartDefinition "$this->decrRef();"
-%feature("unref") DataArrayPartDefinition "$this->decrRef();"
-%feature("unref") SlicePartDefinition "$this->decrRef();"
+%feature("unref") MEDCouplingSkyLineArray "$this->decrRef();"
 
 %rename(assign) *::operator=;
 %ignore MEDCoupling::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
@@ -1161,28 +1158,59 @@ namespace MEDCoupling
     void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
     //
     static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
+    //
+    %extend 
+    {
+      DataArrayDouble *localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const throw(INTERP_KERNEL::Exception)
+      {
+        MCAuto<DataArrayDouble> ret(self->localizePtsInRefCooForEachCell(ptsInRefCoo,mesh));
+        return ret.retn();
+      }
+
+      MEDCouplingUMesh *buildRefCell() const throw(INTERP_KERNEL::Exception)
+      {
+        MCAuto<MEDCouplingUMesh> ret(self->buildRefCell());
+        return ret.retn();
+      }
+    }
   };
 
   class MEDCouplingSkyLineArray
   {
-  public:
-    MEDCouplingSkyLineArray();
-    MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray &myArray );
-    MEDCouplingSkyLineArray( DataArrayInt* index, DataArrayInt* value );
-    MEDCouplingSkyLineArray( const std::vector<int>& index, const std::vector<int>& value );
-  
+  public:  
     void set( DataArrayInt* index, DataArrayInt* value );
     int getNumberOf() const;
     int getLength() const;
     DataArrayInt* getIndexArray() const;
-    DataArrayInt* getValueArray() const;
-      %extend 
-         {
-           std::string __str__() const throw(INTERP_KERNEL::Exception)
-           {
-             return self->simpleRepr();
-           }
-         }
+    DataArrayInt* getValuesArray() const;
+    %extend 
+    {
+      MEDCouplingSkyLineArray() throw(INTERP_KERNEL::Exception)
+      {
+        return MEDCouplingSkyLineArray::New();
+      }
+
+      MEDCouplingSkyLineArray( const std::vector<int>& index, const std::vector<int>& value) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDCouplingSkyLineArray::New(index, value);
+      }
+
+      MEDCouplingSkyLineArray( DataArrayInt* index, DataArrayInt* value ) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDCouplingSkyLineArray::New(index, value);
+      }
+
+      MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray & other ) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDCouplingSkyLineArray::New(other);
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+           
+    }
   };
 }
 
@@ -1827,10 +1855,10 @@ namespace MEDCoupling
     DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
     DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
     MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
+    MEDCouplingSkyLineArray *generateGraph() const throw(INTERP_KERNEL::Exception);
     DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
     DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
     DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
-    MEDCouplingSkyLineArray *generateGraph() const throw(INTERP_KERNEL::Exception);
     DataArrayInt *orderConsecutiveCells1D() const throw(INTERP_KERNEL::Exception);
     DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
     DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
@@ -1876,6 +1904,12 @@ namespace MEDCoupling
         return self->cellIterator();
       }
 
+      static MEDCouplingUMesh *Build1DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception)
+      {
+        MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::Build1DMeshFromCoords(da));
+        return ret.retn();
+      }
+      
       PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
       {
         std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
@@ -2136,6 +2170,16 @@ namespace MEDCoupling
         return ret;
       }
 
+      static PyObject *PartitionBySpreadZone(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<DataArrayInt *> retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn));
+        int sz=retCpp.size();
+        PyObject *ret=PyList_New(sz);
+        for(int i=0;i<sz;i++)
+          PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+
       PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
       {
         int size;
@@ -2626,7 +2670,17 @@ namespace MEDCoupling
         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
         return ret;
       }
-
+      
+      PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayInt *nodeNeigh, const DataArrayInt *nodeNeighI) const throw(INTERP_KERNEL::Exception)
+      {
+        MCAuto<DataArrayInt> cellNeigh,cellNeighIndex;
+        self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+      
       static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
       {
         DataArrayInt *neighbors=0,*neighborsIdx=0;
@@ -2771,6 +2825,21 @@ namespace MEDCoupling
         return ret;
       }
 
+      MEDCouplingUMesh *clipSingle3DCellByPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
+      {
+        double val,val2;
+        DataArrayDouble *a,*a2;
+        DataArrayDoubleTuple *aa,*aa2;
+        std::vector<double> bb,bb2;
+        int sw;
+        const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st paramater for origin.";
+        const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd paramater for vector.";
+        const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
+        const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
+        MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
+        return ret.retn();
+      }
+
       DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
       {
         int spaceDim=self->getSpaceDimension();
@@ -2818,7 +2887,7 @@ namespace MEDCoupling
           default:
             throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
           }
-      }
+      }      
     }
     void convertAllToPoly();
     void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
@@ -3920,7 +3989,19 @@ namespace MEDCoupling
         self->reprQuickOverview(oss);
         return oss.str();
       }
+      
+      MEDCouplingFieldDouble *voronoize(double eps) const throw(INTERP_KERNEL::Exception)
+      {
+        MCAuto<MEDCouplingFieldDouble> ret(self->voronoize(eps));
+        return ret.retn();
+      }
 
+      MEDCouplingFieldDouble *convertQuadraticCellsToLinear() const throw(INTERP_KERNEL::Exception)
+      {
+        MCAuto<MEDCouplingFieldDouble> ret(self->convertQuadraticCellsToLinear());
+        return ret.retn();
+      }
+      
       MEDCouplingFieldDouble *computeVectorFieldCyl(PyObject *center, PyObject *vector) const
       {
         const char msg[]="Python wrap of MEDCouplingFieldDouble::computeVectorFieldCyl : ";
@@ -5867,107 +5948,6 @@ namespace MEDCoupling
 #endif
     }
   };
-  
-  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();
-  };
 }
 
 %pythoncode %{