]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Wed, 24 Aug 2011 12:28:40 +0000 (12:28 +0000)
committerageay <ageay>
Wed, 24 Aug 2011 12:28:40 +0000 (12:28 +0000)
src/MEDLoader/MEDFileField.hxx
src/MEDLoader/MEDFileMesh.cxx
src/MEDLoader/MEDFileMesh.hxx
src/MEDLoader/Swig/MEDLoader.i

index d48bbeb0f348fd8c9128d34e8c1bb00e400141a4..91115902db11a3dc8766da3c3cdb053e68fa0fa8 100644 (file)
@@ -361,6 +361,7 @@ namespace ParaMEDMEM
     void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
     std::string getName() const;
     std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception);
+    std::string getMeshName() const throw(INTERP_KERNEL::Exception);
   public:
     std::vector<std::string> getPflsReallyUsed2() const;
     std::vector<std::string> getLocsReallyUsed2() const;
@@ -368,7 +369,6 @@ namespace ParaMEDMEM
     const MEDFileField1TSWithoutDAS& getTimeStepEntry(int iteration, int order) const throw(INTERP_KERNEL::Exception);
     MEDFileField1TSWithoutDAS& getTimeStepEntry(int iteration, int order) throw(INTERP_KERNEL::Exception);
     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
-    std::string getMeshName() const throw(INTERP_KERNEL::Exception);
     std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
     MEDFileFieldMultiTSWithoutDAS();
     MEDFileFieldMultiTSWithoutDAS(const char *fieldName);
index daddc8bdce88ee471d3a7db917342d36ac7e1236..01c8e136debf6ddbe21dcec5d8709c58b0f3f8fc 100644 (file)
@@ -2216,6 +2216,19 @@ MEDFileMesh *MEDFileMeshes::getMeshAtPos(int i) const throw(INTERP_KERNEL::Excep
   return _meshes[i]->getOneTimeStep();
 }
 
+MEDFileMesh *MEDFileMeshes::getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
+{
+  std::vector<std::string> ms=getMeshesNames();
+  std::vector<std::string>::iterator it=std::find(ms.begin(),ms.end(),mname);
+  if(it==ms.end())
+    {
+      std::ostringstream oss; oss << "MEDFileMeshes::getMeshWithName : Mesh  \"" << mname << "\" does not exist in this ! Existing are : ";
+      std::copy(ms.begin(),ms.end(),std::ostream_iterator<std::string>(oss," "));
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+  return getMeshAtPos((int)std::distance(ms.begin(),it));
+}
+
 std::vector<std::string> MEDFileMeshes::getMeshesNames() const throw(INTERP_KERNEL::Exception)
 {
   std::vector<std::string> ret(_meshes.size());
index aed9e9c685914fc97e5f882f09777bb6a25e14c7..e15a5bc5499a3c349dd979c627dbb1dd6955f74d 100644 (file)
@@ -262,6 +262,7 @@ namespace ParaMEDMEM
     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
     MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception);
+    MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
     //
     void resize(int newSize) throw(INTERP_KERNEL::Exception);
index 7693f3404160772892a9d663ffc43c77fba6d2cd..59dd73948b66845d83055858551124e6fec05ad8 100644 (file)
@@ -77,6 +77,7 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
 %newobject ParaMEDMEM::MEDFileMeshes::New;
 %newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
+%newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
 
 %newobject ParaMEDMEM::MEDFileFields::New;
 %newobject ParaMEDMEM::MEDFileFields::getField;
@@ -523,6 +524,13 @@ namespace ParaMEDMEM
                ret->incrRef();
              return ret;
            }
+         MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
+           {
+             MEDFileMesh *ret=self->getMeshWithName(mname);
+             if(ret)
+               ret->incrRef();
+             return ret;
+           }
        }
   };
 
@@ -595,6 +603,7 @@ namespace ParaMEDMEM
   public:
     int getNumberOfTS() const;
     std::string getName() const;
+    std::string getMeshName() const throw(INTERP_KERNEL::Exception);
     %extend
        {
          PyObject *getIterations() const