]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Tue, 6 Jul 2010 09:17:49 +0000 (09:17 +0000)
committerageay <ageay>
Tue, 6 Jul 2010 09:17:49 +0000 (09:17 +0000)
src/MEDLoader/Swig/libMEDLoader_Swig.i

index 5a5b6087a12ed0ba6baff824212233c30fe116d4..147334ac085b9c94ce4bba021390f981b12a5775 100644 (file)
@@ -34,7 +34,9 @@
 #endif
 
 %newobject MEDLoader::ReadUMeshFromFile;
+%newobject MEDLoader::ReadFieldDouble;
 %newobject MEDLoader::ReadFieldDoubleCell;
+%newobject MEDLoader::ReadFieldDoubleNode;
 
 class MEDLoader
 {
@@ -46,9 +48,38 @@ public:
   static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName);
   %extend
      {
-       static PyObject *GetCellFieldIterations(const char *fileName, const char *fieldName)
+       static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName)
        {
-         std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,fieldName);
+         std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
+         PyObject *ret=PyList_New(res.size());
+         int rk=0;
+         for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
+           {
+             PyObject *elt=PyTuple_New(2);
+             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
+             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
+             PyList_SetItem(ret,rk,elt);
+           }
+         return ret;
+       }
+
+       static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName)
+       {
+         std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
+         PyObject *ret=PyList_New(res.size());
+         int rk=0;
+         for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
+           {
+             PyObject *elt=PyTuple_New(2);
+             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
+             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
+             PyList_SetItem(ret,rk,elt);
+           }
+         return ret;
+       }
+       static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName)
+       {
+         std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
          PyObject *ret=PyList_New(res.size());
          int rk=0;
          for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
@@ -61,10 +92,11 @@ public:
          return ret;
        }
      }
-  //std::vector< std::pair<int,int> > GetNodeFieldIterations(const char *fileName, const char *fieldName);
   static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
   static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
+  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldDouble(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order);
   static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldDoubleCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order);
+  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldDoubleNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order);
   static void WriteUMesh(const char *fileName, ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch);
   static void WriteField(const char *fileName, ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch);
   static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, ParaMEDMEM::MEDCouplingFieldDouble *f);