]> SALOME platform Git repositories - tools/medcoupling.git/blobdiff - src/ParaMEDMEM_Swig/ParaMEDMEMCommon.i
Salome HOME
ParaUMesh.redistributeCells implementation.
[tools/medcoupling.git] / src / ParaMEDMEM_Swig / ParaMEDMEMCommon.i
index 054d680b936fca4f2022b4cbd6cb2f9464b4e60e..b1fcf01033fa7e298dc9d8a650d67a838a5c86ca 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2017-2020  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
@@ -35,6 +35,7 @@
 #include "ICoCoMEDField.hxx"
 #include "ComponentTopology.hxx"
 #include "ParaUMesh.hxx"
+#include "ParaSkyLineArray.hxx"
 
 using namespace INTERP_KERNEL;
 using namespace MEDCoupling;
@@ -57,7 +58,19 @@ using namespace ICoCo;
 %rename(ICoCoMEDField) ICoCo::MEDField;
 %include "ICoCoMEDField.hxx"
 
+%newobject MEDCoupling::ParaUMesh::New;
+%newobject MEDCoupling::ParaUMesh::getMesh;
+%newobject MEDCoupling::ParaUMesh::getGlobalCellIds;
+%newobject MEDCoupling::ParaUMesh::getGlobalNodeIds;
 %newobject MEDCoupling::ParaUMesh::getCellIdsLyingOnNodes;
+%newobject MEDCoupling::ParaUMesh::redistributeCells;
+%newobject MEDCoupling::ParaSkyLineArray::New;
+%newobject MEDCoupling::ParaSkyLineArray::equiRedistribute;
+%newobject MEDCoupling::ParaSkyLineArray::getSkyLineArray;
+%newobject MEDCoupling::ParaSkyLineArray::getGlobalIdsArray;
+
+%feature("unref") ParaSkyLineArray "$this->decrRef();"
+%feature("unref") ParaUMesh "$this->decrRef();"
 
 %nodefaultctor;
 
@@ -121,14 +134,60 @@ namespace MEDCoupling
 
     int reduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm) const;
     int allReduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) const;
+    %extend
+    {
+      PyObject *allGatherArrays(const DataArrayIdType *array) const
+      {
+        std::vector< MCAuto<DataArrayIdType> > ret;
+        self->allGatherArrays(MPI_COMM_WORLD,array,ret);
+        return convertFromVectorAutoObjToPyObj<DataArrayIdType>(ret,SWIGTITraits<mcIdType>::TI);
+      }
+
+      PyObject *allToAllArrays(PyObject *arrays) const
+      {
+        std::vector< DataArrayIdType * > arraysIn;
+        std::vector< MCAuto<DataArrayIdType> > arrayOut;
+        convertFromPyObjVectorOfObj<MEDCoupling::DataArrayIdType*>(arrays,SWIGTITraits<mcIdType>::TI,"DataArrayIdType",arraysIn);
+        std::vector< MCAuto<DataArrayIdType> > arraysIn2(FromVecToVecAuto<DataArrayIdType>(arraysIn));
+        self->allToAllArrays(MPI_COMM_WORLD,arraysIn2,arrayOut);
+        return convertFromVectorAutoObjToPyObj<DataArrayIdType>(arrayOut,SWIGTITraits<mcIdType>::TI);
+      }
+    }
   };
 
-  class ParaUMesh
+  class ParaUMesh : public RefCountObject
   {
   public:
-    ParaUMesh(MEDCouplingUMesh *mesh, DataArrayIdType *globalCellIds, DataArrayIdType *globalNodeIds);
+    static ParaUMesh *New(MEDCouplingUMesh *mesh, DataArrayIdType *globalCellIds, DataArrayIdType *globalNodeIds);
+    ParaUMesh *redistributeCells(const DataArrayIdType *globalCellIds) const;
     %extend
     {
+      ParaUMesh(MEDCouplingUMesh *mesh, DataArrayIdType *globalCellIds, DataArrayIdType *globalNodeIds)
+      {
+        return ParaUMesh::New(mesh,globalCellIds,globalNodeIds);
+      }
+
+      MEDCouplingUMesh *getMesh()
+      {
+        MEDCouplingUMesh *ret(self->getMesh());
+        if(ret) ret->incrRef();
+        return ret;
+      }
+
+      DataArrayIdType *getGlobalCellIds()
+      {
+        DataArrayIdType *ret(self->getGlobalCellIds());
+        if(ret) ret->incrRef();
+        return ret;
+      }
+
+      DataArrayIdType *getGlobalNodeIds()
+      {
+        DataArrayIdType *ret(self->getGlobalNodeIds());
+        if(ret) ret->incrRef();
+        return ret;
+      }
+
       DataArrayIdType *getCellIdsLyingOnNodes(const DataArrayIdType *globalNodeIds, bool fullyIn) const
       { 
         MCAuto<DataArrayIdType> ret(self->getCellIdsLyingOnNodes(globalNodeIds,fullyIn));
@@ -136,6 +195,41 @@ namespace MEDCoupling
       }
     }
   };
+
+  class ParaSkyLineArray : public RefCountObject
+  {
+  public:
+    static ParaSkyLineArray *New(MEDCouplingSkyLineArray *ska, DataArrayIdType *globalIds);
+    %extend
+    {
+      ParaSkyLineArray(MEDCouplingSkyLineArray *ska, DataArrayIdType *globalIds)
+      {
+        return ParaSkyLineArray::New(ska,globalIds);
+      }
+
+      ParaSkyLineArray *equiRedistribute(mcIdType nbOfEntities) const
+      {
+        MCAuto<ParaSkyLineArray> ret(self->equiRedistribute(nbOfEntities));
+        return ret.retn();
+      }
+
+      MEDCouplingSkyLineArray *getSkyLineArray() const
+      {
+        MEDCouplingSkyLineArray *ret(self->getSkyLineArray());
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+      
+      DataArrayIdType *getGlobalIdsArray() const
+      {
+        DataArrayIdType *ret(self->getGlobalIdsArray());
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+    }
+  };
 }
 
 /* This object can be used only if MED_ENABLE_FVM is defined*/