Salome HOME
Merge commit '6600bcec782fc8b6c72871fe6e08bd19a34a4e2b'
[modules/smesh.git] / src / MEDWrapper / MED_Wrapper.cxx
index dbabc2a2d5a7c2c8d4114bd5bb06097dc2d7b2bf..51c9710002dbfce46bd71e9eaa00008cc0a0e215 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 #include "MED_Wrapper.hxx"
 #include "MED_TStructures.hxx"
 #include "MED_Utilities.hxx"
+#include "MED_TFile.hxx"
 
+#include "MEDFileUtilities.hxx"
 #include <med.h>
 #include <med_err.h>
+#include <med_proto.h>
 
-#include <boost/version.hpp>
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-static int MYVALUEDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-static int MYVALUEDEBUG = 0;
+#ifdef WIN32
+#include <windows.h>
 #endif
 
+#include <boost/version.hpp>
+
 namespace MED
 {
   //---------------------------------------------------------------
@@ -49,13 +48,13 @@ namespace MED
 #else
     boost::detail::thread::lock_ops<TWrapper::TMutex>::lock(myWrapper->myMutex);
 #endif
-    INITMSG(MYDEBUG, "TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<std::endl);
+    INITMSG("TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<std::endl);
   }
 
   TLockProxy
   ::~TLockProxy()
   {
-    INITMSG(MYDEBUG, "~TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<std::endl);
+    INITMSG("~TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<std::endl);
 #if BOOST_VERSION >= 103500
     myWrapper->myMutex.unlock();
 #else
@@ -71,69 +70,82 @@ namespace MED
   }
 
   //---------------------------------------------------------------
-  class TFile
+  const TIdt& MEDIDTHoder::Id() const
   {
-    TFile();
-    TFile(const TFile&);
-
-  public:
-    TFile(const std::string& theFileName):
-      myCount(0),
-      myFid(0),
-      myFileName(theFileName)
-    {}
+    if (myFid < 0)
+      EXCEPTION(std::runtime_error, "TFile - GetFid() < 0");
+    return myFid;
+  }
 
-    ~TFile()
+  void TMemFile::Open(EModeAcces theMode, TErr* theErr)
+  {
+    if (this->myCount++ == 0)
     {
-      Close();
+      std::string dftFileName = MEDCoupling::MEDFileWritableStandAlone::GenerateUniqueDftFileNameInMem();
+      med_access_mode modeTmp(MED_ACC_CREAT);
+      if(memfile.app_image_ptr)
+        modeTmp = med_access_mode(theMode);
+      myFid = MEDmemFileOpen(dftFileName.c_str(),&memfile,MED_FALSE,modeTmp);
     }
-
-    void
-    Open(EModeAcces theMode,
-         TErr* theErr = NULL)
-    {
-      if (myCount++ == 0) {
-        const char* aFileName = myFileName.c_str();
-        myFid = MEDfileOpen(aFileName, med_access_mode(theMode));
+    if (theErr)
+      *theErr = TErr(myFid);
+    else if (myFid < 0)
+      EXCEPTION(std::runtime_error,"TMemFile - MEDmemFileOpen");
+  }
+
+  TFile::TFile(const std::string& theFileName, TInt theMajor, TInt theMinor):
+    myFileName(theFileName),
+    myMajor(theMajor),
+    myMinor(theMinor)
+  {
+    if ((myMajor < 0) || (myMajor > MED_MAJOR_NUM)) myMajor = MED_MAJOR_NUM;
+    if ((myMinor < 0) || (myMajor == MED_MAJOR_NUM && myMinor > MED_MINOR_NUM)) myMinor = MED_MINOR_NUM;
+  }
+
+  void TFile::Open(EModeAcces theMode, TErr* theErr)
+  {
+    if (myCount++ == 0) {
+      const char* aFileName = myFileName.c_str();
+#ifdef WIN32
+      if (med_access_mode(theMode) == MED_ACC_RDWR) {
+        // Force removing readonly attribute from a file under Windows, because of a bug in the HDF5
+        std::string aReadOlnyRmCmd = "attrib -r \"" + myFileName + "\"> nul 2>&1";
+#ifdef UNICODE
+        const char* to_decode = aReadOlnyRmCmd.c_str();
+        int size_needed = MultiByteToWideChar(CP_UTF8, 0, to_decode, strlen(to_decode), NULL, 0);
+        wchar_t* awReadOlnyRmCmd = new wchar_t[size_needed + 1];
+        MultiByteToWideChar(CP_UTF8, 0, to_decode, strlen(to_decode), awReadOlnyRmCmd, size_needed);
+        awReadOlnyRmCmd[size_needed] = '\0';
+        _wsystem(awReadOlnyRmCmd);
+        delete[] awReadOlnyRmCmd;
+#else
+        system(aReadOlnyRmCmd.c_str());
+#endif
       }
-      if (theErr)
-        *theErr = TErr(myFid);
-      else if (myFid < 0)
-        EXCEPTION(std::runtime_error, "TFile - MEDfileOpen('"<<myFileName<<"',"<<theMode<<")");
-    }
-
-    const TIdt&
-    Id() const
-    {
-      if (myFid < 0)
-        EXCEPTION(std::runtime_error, "TFile - GetFid() < 0");
-      return myFid;
-    }
-
-    void
-    Close()
-    {
-      if (--myCount == 0)
-        MEDfileClose(myFid);
+#endif
+      myFid = MEDfileVersionOpen(aFileName,med_access_mode(theMode), myMajor, myMinor, MED_RELEASE_NUM);
     }
-
-  protected:
-    TInt myCount;
-    TIdt myFid;
-    std::string myFileName;
-  };
+    if (theErr)
+      *theErr = TErr(myFid);
+    else if (myFid < 0)
+      EXCEPTION(std::runtime_error,"TFile - MEDfileVersionOpen('"<<myFileName<<"',"<<theMode<<"',"<< myMajor <<"',"<< myMinor<<"',"<< MED_RELEASE_NUM<<")");
+  }
 
   //---------------------------------------------------------------
   class TFileWrapper
   {
-    PFile myFile;
+    PFileInternal myFile;
+    TInt myMinor;
 
   public:
-    TFileWrapper(const PFile& theFile,
-                 EModeAcces theMode,
-                 TErr* theErr = NULL):
-      myFile(theFile)
+    TFileWrapper(const PFileInternal& theFile,
+                 EModeAcces           theMode,
+                 TErr*                theErr = NULL,
+                 TInt                 theMinor=-1):
+      myFile(theFile),
+      myMinor(theMinor)
     {
+      if (myMinor < 0) myMinor = MED_MINOR_NUM;
       myFile->Open(theMode, theErr);
     }
 
@@ -148,7 +160,7 @@ namespace MED
   void
   Print(SharedPtr<TimeStampValueType> theTimeStampValue)
   {
-    INITMSG(MYDEBUG,"Print - TimeStampValue\n");
+    INITMSG("Print - TimeStampValue\n");
     typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
     typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
     for (; anIter != aGeom2Value.end(); anIter++) {
@@ -157,43 +169,46 @@ namespace MED
       TInt aNbElem = aMeshValue.myNbElem;
       TInt aNbGauss = aMeshValue.myNbGauss;
       TInt aNbComp = aMeshValue.myNbComp;
-      INITMSG(MYDEBUG, "aGeom = "<<aGeom<<" - "<<aNbElem<<": ");
+      INITMSG("aGeom = "<<aGeom<<" - "<<aNbElem<<": ");
       for (TInt iElem = 0; iElem < aNbElem; iElem++) {
         typename TimeStampValueType::TTMeshValue::TCValueSliceArr aValueSliceArr =
           aMeshValue.GetGaussValueSliceArr(iElem);
-        ADDMSG(MYVALUEDEBUG, "{");
+        ADDMSG("{");
         for (TInt iGauss = 0; iGauss < aNbGauss; iGauss++) {
           const typename TimeStampValueType::TTMeshValue::TCValueSlice& aValueSlice =
             aValueSliceArr[iGauss];
           for (TInt iComp = 0; iComp < aNbComp; iComp++) {
-            ADDMSG(MYVALUEDEBUG, aValueSlice[iComp]<<" ");
+            ADDMSG(aValueSlice[iComp]<<" ");
           }
-          ADDMSG(MYVALUEDEBUG, "| ");
+          ADDMSG("| ");
         }
-        ADDMSG(MYVALUEDEBUG, "} ");
+        ADDMSG("} ");
       }
-      ADDMSG(MYDEBUG, "\n");
+      ADDMSG("\n");
     }
   }
 
   //---------------------------------------------------------------
   TWrapper
-  ::TWrapper(const std::string& theFileName):
-    myFile(new TFile(theFileName))
+  ::TWrapper(const std::string& theFileName, bool write, TFileInternal *tfileInst, TInt theMajor, TInt theMinor):
+    myMajor(theMajor),
+    myMinor(theMinor)
   {
+    if(!tfileInst)
+      myFile.reset(new TFile(theFileName, theMajor, theMinor) );
+    else
+      myFile.reset(new TFileDecorator(tfileInst) );
+    
     TErr aRet;
-    myFile->Open(eLECTURE_ECRITURE, &aRet);
-    // if (aRet < 0)
-    //   myFile->Close();
-    //   myFile->Open(eLECTURE_AJOUT, &aRet);
-    // }
-    if (aRet < 0) {
-      myFile->Close();
-      myFile->Open(eLECTURE, &aRet);
+    if ( write ) {
+      myFile->Open(eLECTURE_ECRITURE, &aRet);
+      if (aRet < 0) {
+        myFile->Close();
+        myFile->Open(eCREATION, &aRet);
+      }
     }
-    if (aRet < 0) {
-      myFile->Close();
-      myFile->Open(eCREATION, &aRet);
+    else {
+      myFile->Open(eLECTURE, &aRet);
     }
   }
 
@@ -208,7 +223,7 @@ namespace MED
   TWrapper
   ::GetNbMeshes(TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -219,11 +234,11 @@ namespace MED
   //----------------------------------------------------------------------------
   void
   TWrapper
-  ::GetMeshInfo(TInt theMeshId,
+  ::GetMeshInfo(TInt            theMeshId,
                 MED::TMeshInfo& theInfo,
-                TErr* theErr)
+                TErr*           theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -262,7 +277,7 @@ namespace MED
   void
   TWrapper
   ::SetMeshInfo(const MED::TMeshInfo& theInfo,
-                TErr* theErr)
+                TErr*                 theErr)
   {
     TErr aRet;
     SetMeshInfo(theInfo, eLECTURE_ECRITURE, &aRet);
@@ -281,10 +296,10 @@ namespace MED
   void
   TWrapper
   ::SetMeshInfo(const MED::TMeshInfo& theInfo,
-                EModeAcces theMode,
-                TErr* theErr)
+                EModeAcces            theMode,
+                TErr*                 theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -318,7 +333,7 @@ namespace MED
     //if (aRet == 0)
     //  aRet = MEDunvCr(myFile->Id(),&aMeshName);
 
-    INITMSG(MYDEBUG, "TWrapper::SetMeshInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
+    INITMSG("TWrapper::SetMeshInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
 
     if (theErr)
       *theErr = aRet;
@@ -329,10 +344,10 @@ namespace MED
   //----------------------------------------------------------------------------
   PMeshInfo
   TWrapper
-  ::CrMeshInfo(TInt theDim,
-               TInt theSpaceDim,
+  ::CrMeshInfo(TInt               theDim,
+               TInt               theSpaceDim,
                const std::string& theValue,
-               EMaillage theType,
+               EMaillage          theType,
                const std::string& theDesc)
   {
     return PMeshInfo(new TTMeshInfo
@@ -354,7 +369,7 @@ namespace MED
   //----------------------------------------------------------------------------
   PMeshInfo
   TWrapper
-  ::GetPMeshInfo(TInt theId,
+  ::GetPMeshInfo(TInt  theId,
                  TErr* theErr)
   {
     PMeshInfo anInfo = CrMeshInfo();
@@ -366,9 +381,9 @@ namespace MED
   TInt
   TWrapper
   ::GetNbFamilies(const MED::TMeshInfo& theInfo,
-                  TErr* theErr)
+                  TErr*                 theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -381,11 +396,11 @@ namespace MED
   //----------------------------------------------------------------------------
   TInt
   TWrapper
-  ::GetNbFamAttr(TInt theFamId,
+  ::GetNbFamAttr(TInt                  theFamId,
                  const MED::TMeshInfo& theInfo,
-                 TErr* theErr)
+                 TErr*                 theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -400,11 +415,11 @@ namespace MED
   //----------------------------------------------------------------------------
   TInt
   TWrapper
-  ::GetNbFamGroup(TInt theFamId,
+  ::GetNbFamGroup(TInt                  theFamId,
                   const MED::TMeshInfo& theInfo,
-                  TErr* theErr)
+                  TErr*                 theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -419,11 +434,11 @@ namespace MED
   //----------------------------------------------------------------------------
   void
   TWrapper
-  ::GetFamilyInfo(TInt theFamId,
+  ::GetFamilyInfo(TInt              theFamId,
                   MED::TFamilyInfo& theInfo,
-                  TErr* theErr)
+                  TErr*             theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -462,7 +477,7 @@ namespace MED
   void
   TWrapper
   ::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
-                  TErr* theErr)
+                  TErr*                   theErr)
   {
     TErr aRet;
     SetFamilyInfo(theInfo, eLECTURE_ECRITURE, &aRet);
@@ -478,10 +493,10 @@ namespace MED
   void
   TWrapper
   ::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
-                  EModeAcces theMode,
-                  TErr* theErr)
+                  EModeAcces              theMode,
+                  TErr*                   theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -506,7 +521,7 @@ namespace MED
                             aNbGroup,
                             &aGroupNames);
 
-    INITMSG(MYDEBUG, "TWrapper::SetFamilyInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
+    INITMSG("TWrapper::SetFamilyInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
 
     if (theErr)
       *theErr = aRet;
@@ -517,10 +532,10 @@ namespace MED
   //----------------------------------------------------------------------------
   PFamilyInfo
   TWrapper
-  ::CrFamilyInfo(const PMeshInfo& theMeshInfo,
-                 TInt theNbGroup,
-                 TInt theNbAttr,
-                 TInt theId,
+  ::CrFamilyInfo(const PMeshInfo&   theMeshInfo,
+                 TInt               theNbGroup,
+                 TInt               theNbAttr,
+                 TInt               theId,
                  const std::string& theValue)
   {
     return PFamilyInfo(new TTFamilyInfo
@@ -534,13 +549,13 @@ namespace MED
   //----------------------------------------------------------------------------
   PFamilyInfo
   TWrapper
-  ::CrFamilyInfo(const PMeshInfo& theMeshInfo,
-                 const std::string& theValue,
-                 TInt theId,
-                 const MED::TStringSet& theGroupNames,
+  ::CrFamilyInfo(const PMeshInfo&          theMeshInfo,
+                 const std::string&        theValue,
+                 TInt                      theId,
+                 const MED::TStringSet&    theGroupNames,
                  const MED::TStringVector& theAttrDescs,
-                 const MED::TIntVector& theAttrIds,
-                 const MED::TIntVector& theAttrVals)
+                 const MED::TIntVector&    theAttrIds,
+                 const MED::TIntVector&    theAttrVals)
   {
     return PFamilyInfo(new TTFamilyInfo
                        (theMeshInfo,
@@ -555,7 +570,7 @@ namespace MED
   //----------------------------------------------------------------------------
   PFamilyInfo
   TWrapper
-  ::CrFamilyInfo(const PMeshInfo& theMeshInfo,
+  ::CrFamilyInfo(const PMeshInfo&   theMeshInfo,
                  const PFamilyInfo& theInfo)
   {
     return PFamilyInfo(new TTFamilyInfo
@@ -567,8 +582,8 @@ namespace MED
   PFamilyInfo
   TWrapper
   ::GetPFamilyInfo(const PMeshInfo& theMeshInfo,
-                   TInt theId,
-                   TErr* theErr)
+                   TInt             theId,
+                   TErr*            theErr)
   {
     // must be reimplemented in connection with mesh type eSTRUCTURE
     //     if (theMeshInfo->GetType() != eNON_STRUCTURE)
@@ -579,17 +594,18 @@ namespace MED
     PFamilyInfo anInfo = CrFamilyInfo(theMeshInfo, aNbGroup, aNbAttr);
     GetFamilyInfo(theId, *anInfo, theErr);
 
-#ifdef _DEBUG_
-    std::string aName = anInfo->GetName();
-    INITMSG(MYDEBUG, "GetPFamilyInfo - aFamilyName = '"<<aName<<
-            "'; andId = "<<anInfo->GetId()<<
-            "; aNbAttr = "<<aNbAttr<<
-            "; aNbGroup = "<<aNbGroup<<"\n");
-    for (TInt iGroup = 0; iGroup < aNbGroup; iGroup++) {
-      aName = anInfo->GetGroupName(iGroup);
-      INITMSG(MYDEBUG, "aGroupName = '"<<aName<<"'\n");
+    if (SALOME::VerbosityActivated())
+    {
+      std::string aName = anInfo->GetName();
+      INITMSG("GetPFamilyInfo - aFamilyName = '"<<aName<<
+              "'; andId = "<<anInfo->GetId()<<
+              "; aNbAttr = "<<aNbAttr<<
+              "; aNbGroup = "<<aNbGroup<<"\n");
+      for (TInt iGroup = 0; iGroup < aNbGroup; iGroup++) {
+        aName = anInfo->GetGroupName(iGroup);
+        INITMSG("aGroupName = '"<<aName<<"'\n");
+      }
     }
-#endif
 
     return anInfo;
   }
@@ -597,13 +613,13 @@ namespace MED
   //----------------------------------------------------------------------------
   void
   TWrapper
-  ::GetNames(TElemInfo& theInfo,
-             TInt theNb,
-             EEntiteMaillage theEntity,
+  ::GetNames(TElemInfo&        theInfo,
+             TInt            /*theNb*/,
+             EEntiteMaillage   theEntity,
              EGeometrieElement theGeom,
-             TErr* theErr)
+             TErr*             theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -635,10 +651,10 @@ namespace MED
   //----------------------------------------------------------------------------
   void
   TWrapper
-  ::SetNames(const TElemInfo& theInfo,
-             EEntiteMaillage theEntity,
+  ::SetNames(const TElemInfo&  theInfo,
+             EEntiteMaillage   theEntity,
              EGeometrieElement theGeom,
-             TErr* theErr)
+             TErr*             theErr)
   {
     SetNames(theInfo, eLECTURE_ECRITURE, theEntity, theGeom, theErr);
   }
@@ -646,13 +662,13 @@ namespace MED
   //----------------------------------------------------------------------------
   void
   TWrapper
-  ::SetNames(const TElemInfo& theInfo,
-             EModeAcces theMode,
-             EEntiteMaillage theEntity,
+  ::SetNames(const TElemInfo&  theInfo,
+             EModeAcces        theMode,
+             EEntiteMaillage   theEntity,
              EGeometrieElement theGeom,
-             TErr* theErr)
+             TErr*             theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -675,7 +691,7 @@ namespace MED
                                  MED_NO_DT,
                                  MED_NO_IT,
                                  anEntity,
-                                  aGeom,
+                                 aGeom,
                                  (TInt)anInfo.myElemNames->size(),
                                  &anElemNames);
       if (theErr)
@@ -688,13 +704,13 @@ namespace MED
   //----------------------------------------------------------------------------
   void
   TWrapper
-  ::GetNumeration(TElemInfo& theInfo,
-                  TInt theNb,
-                  EEntiteMaillage theEntity,
+  ::GetNumeration(TElemInfo&        theInfo,
+                  TInt            /*theNb*/,
+                  EEntiteMaillage   theEntity,
                   EGeometrieElement theGeom,
-                  TErr* theErr)
+                  TErr*             theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -726,10 +742,10 @@ namespace MED
   //----------------------------------------------------------------------------
   void
   TWrapper
-  ::SetNumeration(const TElemInfo& theInfo,
-                  EEntiteMaillage theEntity,
+  ::SetNumeration(const TElemInfo&  theInfo,
+                  EEntiteMaillage   theEntity,
                   EGeometrieElement theGeom,
-                  TErr* theErr)
+                  TErr*             theErr)
   {
     SetNumeration(theInfo, eLECTURE_ECRITURE, theEntity, theGeom, theErr);
   }
@@ -737,13 +753,13 @@ namespace MED
   //----------------------------------------------------------------------------
   void
   TWrapper
-  ::SetNumeration(const TElemInfo& theInfo,
-                  EModeAcces theMode,
-                  EEntiteMaillage theEntity,
+  ::SetNumeration(const TElemInfo&  theInfo,
+                  EModeAcces        theMode,
+                  EEntiteMaillage   theEntity,
                   EGeometrieElement theGeom,
-                  TErr* theErr)
+                  TErr*             theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -779,13 +795,13 @@ namespace MED
   //----------------------------------------------------------------------------
   void
   TWrapper
-  ::GetFamilies(TElemInfo& theInfo,
-                TInt theNb,
-                EEntiteMaillage theEntity,
+  ::GetFamilies(TElemInfo&        theInfo,
+                TInt            /*theNb*/,
+                EEntiteMaillage   theEntity,
                 EGeometrieElement theGeom,
-                TErr* theErr)
+                TErr*             theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -826,10 +842,10 @@ namespace MED
   //----------------------------------------------------------------------------
   void
   TWrapper
-  ::SetFamilies(const TElemInfo& theInfo,
-                EEntiteMaillage theEntity,
+  ::SetFamilies(const TElemInfo&  theInfo,
+                EEntiteMaillage   theEntity,
                 EGeometrieElement theGeom,
-                TErr* theErr)
+                TErr*             theErr)
   {
     SetFamilies(theInfo, eLECTURE_ECRITURE, theEntity, theGeom, theErr);
   }
@@ -837,13 +853,13 @@ namespace MED
   //----------------------------------------------------------------------------
   void
   TWrapper
-  ::SetFamilies(const TElemInfo& theInfo,
-                EModeAcces theMode,
-                EEntiteMaillage theEntity,
+  ::SetFamilies(const TElemInfo&  theInfo,
+                EModeAcces        theMode,
+                EEntiteMaillage   theEntity,
                 EGeometrieElement theGeom,
-                TErr* theErr)
+                TErr*             theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -878,7 +894,7 @@ namespace MED
   TInt
   TWrapper
   ::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
-               TErr* theErr)
+               TErr*                 theErr)
   {
     return GetNbNodes(theMeshInfo, eCOOR, theErr);
   }
@@ -890,7 +906,7 @@ namespace MED
                ETable theTable,
                TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -918,7 +934,7 @@ namespace MED
   ::GetNodeInfo(MED::TNodeInfo& theInfo,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -1009,7 +1025,7 @@ namespace MED
                 EModeAcces theMode,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -1140,37 +1156,38 @@ namespace MED
     PNodeInfo anInfo = CrNodeInfo(theMeshInfo, aNbElems);
     GetNodeInfo(*anInfo, theErr);
 
-#ifdef _DEBUG_
-    TInt aDim = theMeshInfo->myDim;
-    TInt aNbElem = anInfo->GetNbElem();
-    INITMSG(MYDEBUG, "GetPNodeInfo: ");
+    if (SALOME::VerbosityActivated())
     {
-      INITMSG(MYDEBUG, "aCoords: "<<aNbElem<<": ");
-      TNodeCoord& aCoord = anInfo->myCoord;
-      for (TInt iElem = 0; iElem < aNbElem; iElem++) {
-        for (TInt iDim = 0, anId = iElem*aDim; iDim < aDim; iDim++, anId++) {
-          ADDMSG(MYVALUEDEBUG, aCoord[anId]<<",");
+      TInt aDim = theMeshInfo->myDim;
+      TInt aNbElem = anInfo->GetNbElem();
+      INITMSG("GetPNodeInfo: ");
+      {
+        INITMSG("aCoords: "<<aNbElem<<": ");
+        TNodeCoord& aCoord = anInfo->myCoord;
+        for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+          for (TInt iDim = 0, anId = iElem*aDim; iDim < aDim; iDim++, anId++) {
+            ADDMSG(aCoord[anId]<<",");
+          }
+          ADDMSG(" ");
         }
-        ADDMSG(MYVALUEDEBUG, " ");
-      }
-      ADDMSG(MYDEBUG, std::endl);
+        ADDMSG(std::endl);
 
-      BEGMSG(MYVALUEDEBUG, "GetFamNum: ");
-      for (TInt iElem = 0; iElem < aNbElem; iElem++) {
-        ADDMSG(MYVALUEDEBUG, anInfo->GetFamNum(iElem)<<", ");
-      }
-      ADDMSG(MYVALUEDEBUG, std::endl);
-
-      if (anInfo->IsElemNum()) {
-        BEGMSG(MYVALUEDEBUG, "GetElemNum: ");
+        BEGMSG("GetFamNum: ");
         for (TInt iElem = 0; iElem < aNbElem; iElem++) {
-          ADDMSG(MYVALUEDEBUG, anInfo->GetElemNum(iElem)<<", ");
+          ADDMSG(anInfo->GetFamNum(iElem)<<", ");
+        }
+        ADDMSG(std::endl);
+
+        if (anInfo->IsElemNum()) {
+          BEGMSG("GetElemNum: ");
+          for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+            ADDMSG(anInfo->GetElemNum(iElem)<<", ");
+          }
+          ADDMSG(std::endl);
         }
-        ADDMSG(MYVALUEDEBUG, std::endl);
       }
+      ADDMSG(std::endl);
     }
-    ADDMSG(MYDEBUG, std::endl);
-#endif
 
     return anInfo;
   }
@@ -1320,7 +1337,7 @@ namespace MED
                         EConnectivite theConnMode,
                         TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return 0;
@@ -1353,7 +1370,7 @@ namespace MED
   ::GetPolygoneInfo(MED::TPolygoneInfo& theInfo,
                     TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -1412,7 +1429,7 @@ namespace MED
                     EModeAcces theMode,
                     TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -1525,20 +1542,21 @@ namespace MED
     PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo, theEntity, theGeom, aNbElem, aConnSize, theConnMode);
     GetPolygoneInfo(anInfo);
 
-#ifdef _DEBUG_
-    INITMSG(MYDEBUG, "GetPPolygoneInfo"<<
-            " - theGeom = "<<theGeom<<
-            "; aNbElem = "<<aNbElem<<": ");
-    for (TInt iElem = 1; iElem < aNbElem; iElem++) {
-      TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
-      TInt aConnDim = aConnSlice.size();
-      for (TInt iConn = 0; iConn < aConnDim; iConn++) {
-        ADDMSG(MYVALUEDEBUG, aConnSlice[iConn]<<",");
+    if (SALOME::VerbosityActivated())
+    {
+      INITMSG("GetPPolygoneInfo"<<
+              " - theGeom = "<<theGeom<<
+              "; aNbElem = "<<aNbElem<<": ");
+      for (TInt iElem = 1; iElem < aNbElem; iElem++) {
+        TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
+        TInt aConnDim = aConnSlice.size();
+        for (TInt iConn = 0; iConn < aConnDim; iConn++) {
+          ADDMSG(aConnSlice[iConn]<<",");
+        }
+        ADDMSG(" ");
       }
-      ADDMSG(MYDEBUG, " ");
+      ADDMSG(std::endl);
     }
-    ADDMSG(MYDEBUG, std::endl);
-#endif
 
     return anInfo;
   }
@@ -1564,7 +1582,7 @@ namespace MED
                         EConnectivite theConnMode,
                         TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       EXCEPTION(std::runtime_error, "GetPolyedreConnSize - (...)");
@@ -1610,7 +1628,7 @@ namespace MED
   ::GetPolyedreInfo(TPolyedreInfo& theInfo,
                     TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -1673,7 +1691,7 @@ namespace MED
                     EModeAcces theMode,
                     TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -1835,27 +1853,28 @@ namespace MED
     PPolyedreInfo anInfo = CrPolyedreInfo(theMeshInfo, theEntity, theGeom, aNbElem, aNbFaces, aConnSize, theConnMode);
     GetPolyedreInfo(anInfo);
 
-#ifdef _DEBUG_
-    INITMSG(MYDEBUG, "GetPPolyedreInfo"<<
-            " - theGeom = "<<theGeom<<
-            "; aNbElem = "<<aNbElem<<": ");
-    for (TInt iElem = 0; iElem < aNbElem; iElem++) {
-      TCConnSliceArr aConnSliceArr = anInfo->GetConnSliceArr(iElem);
-      TInt aNbFaces = aConnSliceArr.size();
-      ADDMSG(MYDEBUG, "{");
-      for (TInt iFace = 0; iFace < aNbFaces; iFace++) {
-        TCConnSlice aConnSlice = aConnSliceArr[iFace];
-        TInt aNbConn = aConnSlice.size();
-        ADDMSG(MYDEBUG, "[");
-        for (TInt iConn = 0; iConn < aNbConn; iConn++) {
-          ADDMSG(MYVALUEDEBUG, aConnSlice[iConn]<<",");
+    if (SALOME::VerbosityActivated())
+    {
+      INITMSG("GetPPolyedreInfo"<<
+              " - theGeom = "<<theGeom<<
+              "; aNbElem = "<<aNbElem<<": ");
+      for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+        TCConnSliceArr aConnSliceArr = anInfo->GetConnSliceArr(iElem);
+        TInt aNbFaces = aConnSliceArr.size();
+        ADDMSG("{");
+        for (TInt iFace = 0; iFace < aNbFaces; iFace++) {
+          TCConnSlice aConnSlice = aConnSliceArr[iFace];
+          TInt aNbConn = aConnSlice.size();
+          ADDMSG("[");
+          for (TInt iConn = 0; iConn < aNbConn; iConn++) {
+            ADDMSG(aConnSlice[iConn]<<",");
+          }
+          ADDMSG("] ");
         }
-        ADDMSG(MYDEBUG, "] ");
+        ADDMSG("} ");
       }
-      ADDMSG(MYDEBUG, "} ");
+      ADDMSG(std::endl);
     }
-    ADDMSG(MYDEBUG, std::endl);
-#endif
 
     return anInfo;
   }
@@ -1869,7 +1888,7 @@ namespace MED
   {
     TEntityInfo anInfo;
 
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return anInfo;
@@ -1981,7 +2000,7 @@ namespace MED
                EConnectivite theConnMode,
                TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -2030,7 +2049,7 @@ namespace MED
   ::GetCellInfo(MED::TCellInfo& theInfo,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -2051,6 +2070,24 @@ namespace MED
     TValueHolder<EConnectivite, med_connectivity_mode> aConnMode    (theInfo.myConnMode);
 
     TErr aRet;
+    med_bool dummy;
+    aRet = MEDmeshnEntity(myFile->Id(),
+                          &aMeshName,
+                          MED_NO_DT,
+                          MED_NO_IT,
+                          anEntity,
+                          aGeom,
+                          MED_NAME,
+                          aConnMode,
+                          &dummy, &dummy);
+    if ( aRet > 0 )
+    {
+      // names are present in the file, they will be read in spite of theInfo.myIsElemNames
+      theInfo.myIsElemNames = eVRAI;
+      theInfo.myElemNames.reset( new TString( theInfo.myNbElem * GetPNOMLength() + 1 ));
+      anElemNames.myRepresentation = & ((TString&) theInfo.myElemNames )[0];
+    }
+
     aRet = MEDmeshElementRd(myFile->Id(),
                             &aMeshName,
                             MED_NO_DT,
@@ -2073,11 +2110,11 @@ namespace MED
       EXCEPTION(std::runtime_error, "GetCellInfo - MEDmeshElementRd(...)");
 
     if (anIsFamNum == MED_FALSE)
-      {
-        int mySize = (int) theInfo.myFamNum->size();
-        theInfo.myFamNum->clear();
-        theInfo.myFamNum->resize(mySize, 0);
-      }
+    {
+      int mySize = (int) theInfo.myFamNum->size();
+      theInfo.myFamNum->clear();
+      theInfo.myFamNum->resize(mySize, 0);
+    }
 
   }
 
@@ -2097,7 +2134,7 @@ namespace MED
                 EModeAcces theMode,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -2161,20 +2198,20 @@ namespace MED
     if (theErr)
       *theErr = aRet;
     else if (aRet < 0)
-      EXCEPTION(std::runtime_error, "SetCellInfo - MEDmeshElementWr(...)");
+      EXCEPTION(std::runtime_error, "SetCellInfo - MEDmeshElementWr(...), ret="<< aRet);
   }
 
   //----------------------------------------------------------------------------
   PCellInfo
   TWrapper
-  ::CrCellInfo(const PMeshInfo& theMeshInfo,
-               EEntiteMaillage theEntity,
+  ::CrCellInfo(const PMeshInfo&  theMeshInfo,
+               EEntiteMaillage   theEntity,
                EGeometrieElement theGeom,
-               TInt theNbElem,
-               EConnectivite theConnMode,
-               EBooleen theIsElemNum,
-               EBooleen theIsElemNames,
-               EModeSwitch theMode)
+               TInt              theNbElem,
+               EConnectivite     theConnMode,
+               EBooleen          theIsElemNum,
+               EBooleen          theIsElemNames,
+               EModeSwitch       theMode)
   {
     return PCellInfo(new TTCellInfo
                      (theMeshInfo,
@@ -2238,34 +2275,35 @@ namespace MED
     PCellInfo anInfo = CrCellInfo(theMeshInfo, theEntity, theGeom, aNbElem, theConnMode);
     GetCellInfo(anInfo, theErr);
 
-#ifdef _DEBUG_
-    TInt aConnDim = anInfo->GetConnDim();
-    INITMSG(MYDEBUG, "GetPCellInfo - theEntity = "<<theEntity<<"; theGeom = "<<theGeom<<"; aConnDim: "<<aConnDim<<"\n");
-    BEGMSG(MYDEBUG, "GetPCellInfo - aNbElem: "<<aNbElem<<": ");
-    for (TInt iElem = 0; iElem < aNbElem; iElem++) {
-      TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
-      for (TInt iConn = 0; iConn < aConnDim; iConn++) {
-        ADDMSG(MYVALUEDEBUG, aConnSlice[iConn]<<",");
+    if (SALOME::VerbosityActivated())
+    {
+      TInt aConnDim = anInfo->GetConnDim();
+      INITMSG("GetPCellInfo - theEntity = "<<theEntity<<"; theGeom = "<<theGeom<<"; aConnDim: "<<aConnDim<<"\n");
+      BEGMSG("GetPCellInfo - aNbElem: "<<aNbElem<<": ");
+      for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+        TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
+        for (TInt iConn = 0; iConn < aConnDim; iConn++) {
+          ADDMSG(aConnSlice[iConn]<<",");
+        }
+        ADDMSG(" ");
       }
-      ADDMSG(MYVALUEDEBUG, " ");
-    }
-    ADDMSG(MYDEBUG, std::endl);
-
-    BEGMSG(MYVALUEDEBUG, "GetPCellInfo - GetFamNum: ");
-    for (TInt iElem = 0; iElem < aNbElem; iElem++) {
-      ADDMSG(MYVALUEDEBUG, anInfo->GetFamNum(iElem)<<", ");
-    }
-    ADDMSG(MYVALUEDEBUG, std::endl);
+      ADDMSG(std::endl);
 
-    if (anInfo->IsElemNum()) {
-      BEGMSG(MYVALUEDEBUG, "GetPCellInfo - GetElemNum: ");
+      BEGMSG("GetPCellInfo - GetFamNum: ");
       for (TInt iElem = 0; iElem < aNbElem; iElem++) {
-        ADDMSG(MYVALUEDEBUG, anInfo->GetElemNum(iElem)<<", ");
+        ADDMSG(anInfo->GetFamNum(iElem)<<", ");
+      }
+      ADDMSG(std::endl);
+
+      if (anInfo->IsElemNum()) {
+        BEGMSG("GetPCellInfo - GetElemNum: ");
+        for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+          ADDMSG(anInfo->GetElemNum(iElem)<<", ");
+        }
+        ADDMSG(std::endl);
       }
-      ADDMSG(MYVALUEDEBUG, std::endl);
+      ADDMSG(std::endl);
     }
-    ADDMSG(MYDEBUG, std::endl);
-#endif
 
     return anInfo;
   }
@@ -2273,9 +2311,10 @@ namespace MED
   //----------------------------------------------------------------------------
   EGeometrieElement
   TWrapper
-  ::GetBallGeom(const TMeshInfo& theMeshInfo)
+  ::GetBallGeom(const TMeshInfo& /*theMeshInfo*/)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE);
+    TErr anError;
+    TFileWrapper aFileWrapper(myFile, eLECTURE, &anError, myMinor);
 
     // read med_geometry_type of "MED_BALL" element
     char geotypename[ MED_NAME_SIZE + 1] = MED_BALL_NAME;
@@ -2287,7 +2326,8 @@ namespace MED
   TWrapper
   ::GetNbBalls(const TMeshInfo& theMeshInfo)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE);
+    TErr anError;
+    TFileWrapper aFileWrapper(myFile, eLECTURE, &anError, myMinor);
 
     EGeometrieElement ballType = GetBallGeom(theMeshInfo);
     if (ballType < 0)
@@ -2302,7 +2342,7 @@ namespace MED
   ::GetBallInfo(TBallInfo& theInfo,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     // check geometry of MED_BALL
     if (theInfo.myGeom == eBALL)
@@ -2352,7 +2392,7 @@ namespace MED
                 EModeAcces theMode,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     TErr ret;
     char ballsupportname[MED_NAME_SIZE+1] = "BALL_SUPPORT_MESH";
@@ -2412,7 +2452,7 @@ namespace MED
 
     // write node ids
     SetCellInfo(theInfo, theMode, theErr);
-    if (theErr && theErr < 0)
+    if (theErr && *theErr < 0)
       return;
 
     // write diameter
@@ -2480,7 +2520,7 @@ namespace MED
   TWrapper
   ::GetNbFields(TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -2494,7 +2534,7 @@ namespace MED
   ::GetNbComp(TInt theFieldId,
               TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -2509,7 +2549,7 @@ namespace MED
                  MED::TFieldInfo& theInfo,
                  TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -2574,7 +2614,7 @@ namespace MED
                  EModeAcces theMode,
                  TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -2644,14 +2684,14 @@ namespace MED
     PFieldInfo anInfo = CrFieldInfo(theMeshInfo, aNbComp);
     GetFieldInfo(theId, *anInfo, theErr);
 
-#ifdef _DEBUG_
-    INITMSG(MYDEBUG,
-            "GetPFieldInfo "<<
-            "- aName = '"<<anInfo->GetName()<<"'"<<
-            "; aType = "<<anInfo->GetType()<<
-            "; aNbComp = "<<aNbComp<<
-            std::endl);
-#endif
+    if (SALOME::VerbosityActivated())
+    {
+      INITMSG("GetPFieldInfo "<<
+              "- aName = '"<<anInfo->GetName()<<"'"<<
+              "; aType = "<<anInfo->GetType()<<
+              "; aNbComp = "<<aNbComp<<
+              std::endl);
+    }
 
     return anInfo;
   }
@@ -2661,7 +2701,7 @@ namespace MED
   TWrapper
   ::GetNbGauss(TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -2675,7 +2715,7 @@ namespace MED
   ::GetGaussPreInfo(TInt theId,
                     TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return TGaussInfo::TInfo(TGaussInfo::TKey(ePOINT1, ""), 0);
@@ -2711,11 +2751,11 @@ namespace MED
   //----------------------------------------------------------------------------
   void
   TWrapper
-  ::GetGaussInfo(TInt theId,
+  ::GetGaussInfo(TInt /*theId*/,
                  TGaussInfo& theInfo,
                  TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -2761,7 +2801,7 @@ namespace MED
                     TErr* theErr)
   {
     theEntity = EEntiteMaillage(-1);
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr) {
       if (theEntityInfo.empty())
@@ -2853,14 +2893,12 @@ namespace MED
           }
         bool anIsSatisfied =(nval > 0);
         if (anIsSatisfied) {
-          INITMSG(MYDEBUG,
-                  "GetNbTimeStamps aNbTimeStamps = "<<aNbStamps<<
+          INITMSG("GetNbTimeStamps aNbTimeStamps = "<<aNbStamps<<
                   "; aGeom = "<<aGeom<<"; anEntity = "<<anEntity<<"\n");
           if (anIsPerformAdditionalCheck) {
             anIsSatisfied = !strcmp(&aMeshName[0], &aMeshInfo.myName[0]);
             if (!anIsSatisfied) {
-              INITMSG(MYDEBUG,
-                      "GetNbTimeStamps aMeshName = '"<<&aMeshName[0]<<"' != "<<
+              INITMSG("GetNbTimeStamps aMeshName = '"<<&aMeshName[0]<<"' != "<<
                       "; aMeshInfo.myName = '"<<&aMeshInfo.myName[0]<<"'\n");
             }
           }
@@ -2884,7 +2922,7 @@ namespace MED
                      MED::TTimeStampInfo& theInfo,
                      TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     const TGeom2Size& aGeom2Size = theInfo.myGeom2Size;
 
@@ -3019,15 +3057,16 @@ namespace MED
     PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo, theEntity, theGeom2Size);
     GetTimeStampInfo(theId, *anInfo, theErr);
 
-#ifdef _DEBUG_
-    INITMSG(MYDEBUG, "GetPTimeStampInfo - anEntity = "<<anInfo->GetEntity()<<"\n");
-    TGeom2NbGauss& aGeom2NbGauss = anInfo->myGeom2NbGauss;
-    TGeom2NbGauss::const_iterator anIter = aGeom2NbGauss.begin();
-    for (; anIter != aGeom2NbGauss.end(); anIter++) {
-      const EGeometrieElement& aGeom = anIter->first;
-      INITMSG(MYDEBUG, "aGeom = "<<aGeom<<" - "<<aGeom2NbGauss[aGeom]<<";\n");
+    if (SALOME::VerbosityActivated())
+    {
+      INITMSG("GetPTimeStampInfo - anEntity = "<<anInfo->GetEntity()<<"\n");
+      TGeom2NbGauss& aGeom2NbGauss = anInfo->myGeom2NbGauss;
+      TGeom2NbGauss::const_iterator anIter = aGeom2NbGauss.begin();
+      for (; anIter != aGeom2NbGauss.end(); anIter++) {
+        const EGeometrieElement& aGeom = anIter->first;
+        INITMSG("aGeom = "<<aGeom<<" - "<<aGeom2NbGauss[aGeom]<<";\n");
+      }
     }
-#endif
 
     return anInfo;
   }
@@ -3037,7 +3076,7 @@ namespace MED
   TWrapper
   ::GetNbProfiles(TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -3051,7 +3090,7 @@ namespace MED
   ::GetProfilePreInfo(TInt theId,
                       TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return TProfileInfo::TInfo();
@@ -3075,11 +3114,11 @@ namespace MED
   //----------------------------------------------------------------------------
   void
   TWrapper
-  ::GetProfileInfo(TInt theId,
+  ::GetProfileInfo(TInt /*theId*/,
                    TProfileInfo& theInfo,
                    TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -3124,7 +3163,7 @@ namespace MED
                    EModeAcces theMode,
                    TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -3177,7 +3216,7 @@ namespace MED
                       const TKey2Gauss& theKey2Gauss,
                       TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -3242,8 +3281,7 @@ namespace MED
                                        aNbComp);
       TInt aValueSize = theTimeStampValue->GetValueSize(aGeom);
 
-      INITMSG(MYDEBUG,
-              "TWrapper::GetTimeStampValue - aGeom = "<<aGeom<<
+      INITMSG("TWrapper::GetTimeStampValue - aGeom = "<<aGeom<<
               "; aNbVal = "<<aNbVal<<
               "; aNbValue = "<<aNbValue<<
               "; aNbGauss = "<<aNbGauss<<
@@ -3361,7 +3399,7 @@ namespace MED
                       EModeAcces theMode,
                       TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -3433,7 +3471,7 @@ namespace MED
 
     }
 
-    INITMSG(MYDEBUG, "TWrapper::SetTimeStampValue - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
+    INITMSG("TWrapper::SetTimeStampValue - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
   }
 
   //----------------------------------------------------------------------------
@@ -3516,12 +3554,13 @@ namespace MED
                       theMKey2Profile,
                       theKey2Gauss,
                       theErr);
-#ifdef _DEBUG_
-    if (aFieldInfo->GetType() == eFLOAT64)
-      Print<TFloatTimeStampValue>(anInfo);
-    else
-      Print<TIntTimeStampValue>(anInfo);
-#endif
+    if (SALOME::VerbosityActivated())
+    {
+      if (aFieldInfo->GetType() == eFLOAT64)
+        Print<TFloatTimeStampValue>(anInfo);
+      else
+        Print<TIntTimeStampValue>(anInfo);
+    }
     return anInfo;
   }
 
@@ -3651,33 +3690,32 @@ namespace MED
     GetGrilleInfo(anInfo);
     anInfo->SetGrilleType(type);
 
-#ifdef _DEBUG_
-    INITMSG(MYDEBUG, "GetPGrilleInfo: ");
+    if (SALOME::VerbosityActivated())
     {
+      INITMSG("GetPGrilleInfo: ");
+
       TInt aNbElem = anInfo->GetNbNodes();
-      BEGMSG(MYVALUEDEBUG, "GetFamNumNode: ");
+      BEGMSG("GetFamNumNode: ");
       for (TInt iElem = 0; iElem < aNbElem; iElem++) {
-        ADDMSG(MYVALUEDEBUG, anInfo->GetFamNumNode(iElem)<<", ");
+        ADDMSG(anInfo->GetFamNumNode(iElem)<<", ");
       }
       TInt aNbCells = anInfo->GetNbCells();
-      BEGMSG(MYVALUEDEBUG, "GetFamNum: ");
+      BEGMSG("GetFamNum: ");
       for (TInt iElem = 0; iElem < aNbCells; iElem++) {
-        ADDMSG(MYVALUEDEBUG, anInfo->GetFamNum(iElem)<<", ");
+        ADDMSG(anInfo->GetFamNum(iElem)<<", ");
       }
-      ADDMSG(MYVALUEDEBUG, std::endl);
-      BEGMSG(MYVALUEDEBUG, "GetCoordName: ");
+      ADDMSG(std::endl);
+      BEGMSG("GetCoordName: ");
       for (TInt iElem = 0; iElem < theMeshInfo->GetDim(); iElem++) {
-        ADDMSG(MYVALUEDEBUG, anInfo->GetCoordName(iElem)<<", ");
+        ADDMSG(anInfo->GetCoordName(iElem)<<", ");
       }
-      ADDMSG(MYVALUEDEBUG, std::endl);
-      BEGMSG(MYVALUEDEBUG, "GetCoordUnit: ");
+      ADDMSG(std::endl);
+      BEGMSG("GetCoordUnit: ");
       for (TInt iElem = 0; iElem < theMeshInfo->GetDim(); iElem++) {
-        ADDMSG(MYVALUEDEBUG, anInfo->GetCoordUnit(iElem)<<", ");
+        ADDMSG(anInfo->GetCoordUnit(iElem)<<", ");
       }
-      ADDMSG(MYVALUEDEBUG, std::endl);
-
+      ADDMSG(std::endl);
     }
-#endif
 
     return anInfo;
   }
@@ -3698,7 +3736,7 @@ namespace MED
   ::GetGrilleInfo(TGrilleInfo& theInfo,
                   TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -3868,7 +3906,7 @@ namespace MED
   {
     if (theInfo.myMeshInfo->myType != eSTRUCTURE)
       return;
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -3954,7 +3992,7 @@ namespace MED
   //----------------------------------------------------------------------------
   PGrilleInfo
   TWrapper
-  ::CrGrilleInfo(const PMeshInfo& theMeshInfo)
+  ::CrGrilleInfo(const PMeshInfo& /*theMeshInfo*/)
   {
     return PGrilleInfo(); // not implemented????
   }
@@ -4003,7 +4041,7 @@ namespace MED
                   EGrilleType& theGridType,
                   TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       EXCEPTION(std::runtime_error, " GetGrilleType - aFileWrapper (...)");
@@ -4029,7 +4067,7 @@ namespace MED
                     TIntVector& theStruct,
                     TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;