]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Fri, 8 Oct 2010 14:00:22 +0000 (14:00 +0000)
committerageay <ageay>
Fri, 8 Oct 2010 14:00:22 +0000 (14:00 +0000)
src/MEDCoupling_Swig/MEDCouplingTypemaps.i
src/MEDCoupling_Swig/libMEDCoupling_Swig.i

index e27bc7dd73974f3065aa8bdeb0d70378d4243e5e..9063c82bcb2b89736c5c9a60a19c6e35f0e8ae95 100644 (file)
@@ -164,6 +164,15 @@ static PyObject *convertDblArrToPyList(const double *ptr, int size)
   return ret;
 }
 
+static PyObject *convertDblArrToPyList2(const std::vector<double>& v)
+{
+  int size=v.size();
+  PyObject *ret=PyList_New(size);
+  for(int i=0;i<size;i++)
+    PyList_SetItem(ret,i,PyFloat_FromDouble(v[i]));
+  return ret;
+}
+
 static double *convertPyToNewDblArr2(PyObject *pyLi, int *size)
 {
   if(PyList_Check(pyLi))
index a70223e5e26f5dad1cdb47f8405c41bac4f6f4c6..e31d8881a4fb580b9cfa4b124d8e1ec94a97f442 100644 (file)
@@ -212,8 +212,6 @@ namespace ParaMEDMEM
     virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const = 0;
     virtual std::string simpleRepr() const = 0;
     virtual std::string advancedRepr() const = 0;
-    virtual void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const = 0;
-    virtual void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const = 0;
     // tools
     virtual void getBoundingBox(double *bbox) const = 0;
     virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const = 0;
@@ -259,6 +257,19 @@ namespace ParaMEDMEM
            delete [] tmp;
            return ret;
          }
+         PyObject *getNodeIdsOfCell(int cellId) const
+         {
+           std::vector<int> conn;
+           self->getNodeIdsOfCell(cellId,conn);
+           return convertIntArrToPyList2(conn);
+         }
+
+         PyObject *getCoordinatesOfNode(int nodeId) const
+         {
+           std::vector<double> coo;
+           self->getCoordinatesOfNode(nodeId,coo);
+           return convertDblArrToPyList2(coo);
+         }
        }
   };
 }