Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / CONVERTOR / VISU_MedConvertor.cxx
index a5531c172aa4f9ca6adb1e36f7614d3bbb11539b..66ce4c1d5a46878a371035d8f6f47c0c06f5d7da 100644 (file)
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //  File   : VISU_MedConvertor.cxx
 //  Author : Alexey PETROV
 //  Module : VISU
 
+using namespace std;
 
 #include "VISU_MedConvertor.hxx"
-#include "VISU_Convertor.hxx"
 #include "VISU_ConvertorUtils.hxx"
 
 #include "MED_Factory.hxx"
 #include "MED_GaussUtils.hxx"
 #include "MED_Utilities.hxx"
 
-#include "CASCatch.hxx"
+#include "SALOMEconfig.h"
 
-#include <vtkCellType.h>
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+#define NO_CAS_CATCH
+#endif
 
-using namespace std;
-using namespace VISU;
+#include <Standard_Failure.hxx>
+
+#ifdef NO_CAS_CATCH
+#include <Standard_ErrorHandler.hxx>
+#endif
+
+#include <vtkCellType.h>
 
 using MED::TInt;
 using MED::TFloat;
@@ -61,6 +68,8 @@ static int MY_GROUP_DEBUG = 0;
 #define _LOAD_FAMILIES_
 #define _EDF_NODE_IDS_
 
+
+
 namespace
 {
   //---------------------------------------------------------------
@@ -134,10 +143,10 @@ namespace
   MEDEntityToVTK(MED::EEntiteMaillage theMEDEntity)
   {
     switch(theMEDEntity){
-    case MED::eNOEUD: return NODE_ENTITY;
-    case MED::eARETE: return EDGE_ENTITY;
-    case MED::eFACE: return FACE_ENTITY;
-    case MED::eMAILLE: return CELL_ENTITY;
+    case MED::eNOEUD: return VISU::NODE_ENTITY;
+    case MED::eARETE: return VISU::EDGE_ENTITY;
+    case MED::eFACE: return VISU::FACE_ENTITY;
+    case MED::eMAILLE: return VISU::CELL_ENTITY;
     }
     return VISU::TEntity(-1);
   }
@@ -145,20 +154,20 @@ namespace
 
   //---------------------------------------------------------------
   MED::EEntiteMaillage 
-  VTKEntityToMED(TEntity theVTKEntity)
+  VTKEntityToMED(VISU::TEntity theVTKEntity)
   {
     switch(theVTKEntity){
-    case NODE_ENTITY: return MED::eNOEUD;
-    case EDGE_ENTITY: return MED::eARETE;
-    case FACE_ENTITY: return MED::eFACE;
-    case CELL_ENTITY: return MED::eMAILLE;
+    case VISU::NODE_ENTITY: return MED::eNOEUD;
+    case VISU::EDGE_ENTITY: return MED::eARETE;
+    case VISU::FACE_ENTITY: return MED::eFACE;
+    case VISU::CELL_ENTITY: return MED::eMAILLE;
     }
     return MED::EEntiteMaillage(-1);
   }
 
 
   //---------------------------------------------------------------
-  PMEDSubProfile
+  VISU::PMEDSubProfile
   CrSubProfile(const MED::PWrapper& theMEDWrapper,
               const MED::PMeshInfo& theMeshInfo,
               MED::EEntiteMaillage theMEntity,
@@ -169,21 +178,21 @@ namespace
     VISU::EGeometry aEGeom = MEDGeom2VISU(theMGeom);
     vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
 
-    PMEDSubProfile aSubProfile(new TMEDSubProfile());
+    VISU::PMEDSubProfile aSubProfile(new VISU::TMEDSubProfile());
     aSubProfile->myGeom = aEGeom;
     aSubProfile->myMGeom = theMGeom;
-    aSubProfile->myStatus = eAddAll;
+    aSubProfile->myStatus = VISU::eAddAll;
 
     MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(theMGeom);
     if(aTimeStampIter == theGeom2Size.end())
-      aSubProfile->myStatus = eRemoveAll;
+      aSubProfile->myStatus = VISU::eRemoveAll;
     else{
       MED::TGeom2Profile::const_iterator aProfileIter = theGeom2Profile.find(theMGeom);
       if(aProfileIter != theGeom2Profile.end()){
        MED::PProfileInfo aProfileInfo = aProfileIter->second;
 
        aSubProfile->myName = aProfileInfo->GetName();
-       aSubProfile->myStatus = eAddPart;
+       aSubProfile->myStatus = VISU::eAddPart;
 
        const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
        TInt aNbElem = anElemNum.size();
@@ -267,29 +276,29 @@ namespace
 
 
   //---------------------------------------------------------------
-  TProfileKey
+  VISU::TProfileKey
   GetProfileKey(const MED::PWrapper& theMEDWrapper,
                const MED::PMeshInfo& theMeshInfo,
-               const MED::TTimeStampVal& theTimeStampVal,
+               const MED::PTimeStampValueBase& theTimeStampValue,
                const VISU::TMEDMeshOnEntity& theMeshOnEntity,
                MED::EEntiteMaillage theMEntity,
                const MED::TGeom2Size& theGeom2Size)
   {
     INITMSG(MYDEBUG,"GetProfileKey"<<endl);
     
-    TProfileKey aProfileKey;
-    const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
+    VISU::TProfileKey aProfileKey;
+    const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
 
     const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
     MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
     for(; anIter != aGeom2Size.end(); anIter++){
       MED::EGeometrieElement aMGeom = anIter->first;
-      PSubProfile aSubProfile = CrSubProfile(theMEDWrapper,
-                                            theMeshInfo,
-                                            theMEntity,
-                                            aMGeom,
-                                            theGeom2Size,
-                                            aGeom2Profile);
+      VISU::PSubProfile aSubProfile = CrSubProfile(theMEDWrapper,
+                                                  theMeshInfo,
+                                                  theMEntity,
+                                                  aMGeom,
+                                                  theGeom2Size,
+                                                  aGeom2Profile);
       aProfileKey.insert(aSubProfile);
     }
     
@@ -301,37 +310,37 @@ namespace
   void
   InitProfile(const MED::PWrapper& theMEDWrapper,
              const MED::PMeshInfo& theMeshInfo,
-             MED::TTimeStampVal& theTimeStampVal,
+             MED::PTimeStampValueBase& theTimeStampValue,
              VISU::TMEDMeshOnEntity& theMeshOnEntity,
              MED::EEntiteMaillage theMEntity,
              const MED::TGeom2Size& theGeom2Size,
              VISU::TMEDValForTime& theValForTime)
   {
-    TTimerLog aTimerLog(MYDEBUG,"InitProfile");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"InitProfile");
     INITMSG(MYDEBUG,"InitProfile"<<endl);
     
-    TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
+    VISU::TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
     
-    TProfileKey aProfileKey = GetProfileKey(theMEDWrapper,
+    VISU::TProfileKey aProfileKey = GetProfileKey(theMEDWrapper,
                                            theMeshInfo,
-                                           theTimeStampVal,
+                                           theTimeStampValue,
                                            theMeshOnEntity,
                                            theMEntity,
                                            theGeom2Size);
     
-    TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
+    VISU::TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
     if(anIter != aProfileMap.end()){
       theValForTime.myProfile = anIter->second;
       INITMSG(MYDEBUG,"aProfileMap.find(aProfileKey)"<<endl);
     }else{
-      PMEDProfile aProfile(new TMEDProfile());
-      TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+      VISU::PMEDProfile aProfile(new VISU::TMEDProfile());
+      VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
       
-      TProfileKey::const_iterator anIter = aProfileKey.begin();
+      VISU::TProfileKey::const_iterator anIter = aProfileKey.begin();
       for(; anIter != aProfileKey.end(); anIter++){
-       PMEDSubProfile aSubProfile(*anIter);
+       VISU::PMEDSubProfile aSubProfile(*anIter);
 
-       if(aProfile->myIsAll && aSubProfile->myStatus != eAddAll)
+       if(aProfile->myIsAll && aSubProfile->myStatus != VISU::eAddAll)
          aProfile->myIsAll = false;
 
        VISU::EGeometry aEGeom = aSubProfile->myGeom;
@@ -345,20 +354,20 @@ namespace
 
 
   //---------------------------------------------------------------
-  TGaussKey
-  GetGaussKey(const MED::TTimeStampVal& theTimeStampVal,
+  VISU::TGaussKey
+  GetGaussKey(const MED::PTimeStampValueBase& theTimeStampValue,
              const VISU::TMEDMeshOnEntity& theMeshOnEntity,
              const MED::TGeom2Size& theGeom2Size,
              VISU::TMEDValForTime& theValForTime)
   {
-    TTimerLog aTimerLog(MYDEBUG,"GetGaussKey");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"GetGaussKey");
     INITMSG(MYDEBUG,"GetGaussKey"<<endl);
 
-    TGaussKey aGaussKey;
-    PMEDProfile aProfile = theValForTime.myProfile;
-    TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+    VISU::TGaussKey aGaussKey;
+    VISU::PMEDProfile aProfile = theValForTime.myProfile;
+    VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
 
-    const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
+    const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
     const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
 
     const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
@@ -367,24 +376,24 @@ namespace
       MED::EGeometrieElement aMGeom = anIter->first;
       VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
 
-      TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aEGeom);
+      VISU::TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aEGeom);
       if(anIter2 == aGeom2SubProfile.end()){
        INITMSG(MYDEBUG,"anIter2 == aGeom2SubProfile.end!!"<<endl);
        continue;
       }
-      PMEDSubProfile aSubProfile = anIter2->second;
+      VISU::PMEDSubProfile aSubProfile = anIter2->second;
 
       MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom);
       if(aTimeStampIter != theGeom2Size.end()){
        TInt aNbCells = aTimeStampIter->second;
-       if(aSubProfile->myStatus == eAddPart)
+       if(aSubProfile->myStatus == VISU::eAddPart)
          aNbCells = aSubProfile->myNbCells;
 
-       PMEDGaussSubMesh aGaussSubMesh(new TMEDGaussSubMesh());
+       VISU::PMEDGaussSubMesh aGaussSubMesh(new VISU::TMEDGaussSubMesh());
        aGaussSubMesh->mySubProfile = aSubProfile;
        aGaussSubMesh->myStatus = aSubProfile->myStatus;
          
-       PMEDGauss aGauss(new TMEDGauss());
+       VISU::PMEDGauss aGauss(new VISU::TMEDGauss());
        aGaussSubMesh->myGauss = aGauss;
        aGauss->myGeom = aEGeom;
        aGauss->myNbPoints = 1;
@@ -410,6 +419,8 @@ namespace
                 "; aNbCells = "<<aGaussSubMesh->myNbCells<<
                 "; aCellsSize = "<<aGaussSubMesh->myCellsSize<<
                 endl);
+
+       //break;
       }
     }
 
@@ -419,50 +430,50 @@ namespace
 
   //---------------------------------------------------------------
   void
-  InitGaussMesh(MED::TTimeStampVal& theTimeStampVal,
+  InitGaussMesh(MED::PTimeStampValueBase& theTimeStampValue,
                VISU::TMEDMeshOnEntity& theMeshOnEntity,
                const MED::TGeom2Size& theGeom2Size,
                VISU::TMEDValForTime& theValForTime)
   {
-    TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh");
     INITMSG(MYDEBUG,"InitGaussMesh"<<endl);
 
-    if(theMeshOnEntity.myEntity == NODE_ENTITY)
+    if(theMeshOnEntity.myEntity == VISU::NODE_ENTITY)
       return;
 
-    TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
+    VISU::TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
     
-    TGaussKey aGaussKey = GetGaussKey(theTimeStampVal,
-                                     theMeshOnEntity,
-                                     theGeom2Size,
-                                     theValForTime);
+    VISU::TGaussKey aGaussKey = GetGaussKey(theTimeStampValue,
+                                           theMeshOnEntity,
+                                           theGeom2Size,
+                                           theValForTime);
 
-    TGaussMeshMap::const_iterator anIter = aGaussMeshMap.find(aGaussKey);
+    VISU::TGaussMeshMap::const_iterator anIter = aGaussMeshMap.find(aGaussKey);
     if(anIter != aGaussMeshMap.end()){
       theValForTime.myGaussMesh = anIter->second;
       INITMSG(MYDEBUG,"aGaussMeshMap.find(aGaussKey)"<<endl);
     }else{
-      PMEDGaussMesh aGaussMesh(new TMEDGaussMesh());
-      TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+      VISU::PMEDGaussMesh aGaussMesh(new VISU::TMEDGaussMesh());
+      VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
       {
-       TGaussKey::const_iterator anIter = aGaussKey.begin();
+       VISU::TGaussKey::const_iterator anIter = aGaussKey.begin();
        for(; anIter != aGaussKey.end(); anIter++){
-         PMEDGaussSubMesh aGaussSubMesh(*anIter);
-         PMEDGauss aGauss = aGaussSubMesh->myGauss;
+         VISU::PMEDGaussSubMesh aGaussSubMesh(*anIter);
+         VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
          VISU::EGeometry aEGeom = aGauss->myGeom;
          aGeom2GaussSubMesh[aEGeom] = aGaussSubMesh;
        }
       }
       {
-       TGaussSubMeshArr& aGaussSubMeshArr = aGaussMesh->myGaussSubMeshArr;
+       VISU::TGaussSubMeshArr& aGaussSubMeshArr = aGaussMesh->myGaussSubMeshArr;
        aGaussSubMeshArr.resize(aGeom2GaussSubMesh.size());
-       TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
+       VISU::TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
        for(TInt anID = 0; anIter != aGeom2GaussSubMesh.end(); anIter++, anID++){
-         const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
+         const VISU::PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
          aGaussSubMeshArr[anID] = aGaussSubMesh;
        }
       }
-      INITMSG(MYDEBUG,"aGaussMeshMap[aGaussKey] = aGaussMesh"<<endl);
+      INITMSG(MYDEBUG,"aGaussMeshMap[aGaussKey] = aGaussMesh"<<std::endl);
       aGaussMeshMap[aGaussKey] = aGaussMesh;
       theValForTime.myGaussMesh = aGaussMesh;
     }
@@ -473,25 +484,25 @@ namespace
   void
   InitGaussProfile(const MED::PWrapper& theMEDWrapper,
                   const MED::PMeshInfo& theMeshInfo,
-                  MED::TTimeStampVal& theTimeStampVal,
+                  MED::PTimeStampValueBase& theTimeStampValue,
                   VISU::TMEDMeshOnEntity& theMeshOnEntity,
                   MED::EEntiteMaillage theMEntity,
                   const MED::TGeom2Size& theGeom2Size,
                   VISU::TMEDValForTime& theValForTime)
   {
-    TTimerLog aTimerLog(MYDEBUG,"InitGaussProfile");
-    INITMSG(MYDEBUG,"InitGaussProfile"<<endl);
+    VISU::TTimerLog aTimerLog(MYDEBUG,"InitGaussProfile");
+    INITMSG(MYDEBUG,"InitGaussProfile"<<std::endl);
 
     // The order of the function calls is important
     InitProfile(theMEDWrapper,
                theMeshInfo,
-               theTimeStampVal,
+               theTimeStampValue,
                theMeshOnEntity,
                theMEntity,
                theGeom2Size,
                theValForTime);
 
-    InitGaussMesh(theTimeStampVal,
+    InitGaussMesh(theTimeStampValue,
                  theMeshOnEntity,
                  theGeom2Size,
                  theValForTime);
@@ -500,28 +511,29 @@ namespace
 
   //---------------------------------------------------------------
   void
-  BuildMeshOnEntityMap(PMEDMesh theMesh,
+  BuildMeshOnEntityMap(VISU::PMEDMesh theMesh,
                       const MED::TEntityInfo& theEntityInfo,
                       const MED::PNodeInfo& theNodeInfo,
                       const MED::PWrapper& theMEDWrapper)
   {
-    TTimerLog aTimerLog(MYDEBUG,"BuildMeshOnEntityMap");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshOnEntityMap");
     INITMSG(MYDEBUG,"BuildMeshOnEntityMap"<<endl);
 
     MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
     const std::string& aMeshName = theMesh->myName;
-    TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+    VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
     MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
     for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
       const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
       const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
       
-      TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
+      VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+      VISU::PMEDMeshOnEntity aMeshOnEntity = 
+       aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
       aMeshOnEntity->myEntity = aVEntity;
       aMeshOnEntity->myMeshName = aMeshName;
       aMeshOnEntity->myGeom2Size = aGeom2Size;
-      TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+      VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
 
       INITMSG(MYDEBUG,
              "- aMEntity = "<<aMEntity<<
@@ -541,7 +553,7 @@ namespace
        INITMSG(MYDEBUG,
                "- myNbCells = "<<aMeshOnEntity->myNbCells<<
                "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
-               endl);;
+               std::endl);
        
       }else{
        MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
@@ -624,28 +636,76 @@ namespace
 
   //---------------------------------------------------------------
   void
-  BuildMeshGrilleOnEntityMap(PMEDMesh theMesh,
+  BuildMeshGrilleOnEntityMap(VISU::PMEDMesh theMesh,
                             const MED::TEntityInfo& theEntityInfo,
                             const MED::PGrilleInfo& theGrilleInfo,
                             const MED::PWrapper& theMEDWrapper)
   {
-    TTimerLog aTimerLog(MYDEBUG,"BuildMeshGrilleOnEntityMap");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshGrilleOnEntityMap");
     INITMSG(MYDEBUG,"BuildMeshGrilleOnEntityMap"<<endl);
     
     MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
     const std::string& aMeshName = theMesh->myName;
-    TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+    VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
     MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
+    
+    //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
+    int iMax,jMax,kMax;
+    iMax=jMax=kMax=0;
+    
+    MED::TIntVector aIntVec;
+    if(theGrilleInfo->GetGrilleType()!=MED::eGRILLE_STANDARD)
+      for(int i=0;i<theMesh->myDim;i++)
+       aIntVec.push_back(theGrilleInfo->GetNbIndexes(i));
+    else
+      aIntVec = theGrilleInfo->GetGrilleStructure();
+    
+    theMesh->myGrilleStructure = aIntVec;
+    
+    switch((theMesh->GetStructure()).size()){
+    case 3: kMax=theMesh->GetStructure()[2];
+    case 2: jMax=theMesh->GetStructure()[1];
+    case 1: iMax=theMesh->GetStructure()[0];
+    }
+    
+    int iii=0;
+    switch(theMesh->myDim){
+    case 1:
+      for(int i=1;i<=iMax;i++)
+       (theMesh->myObjID2StructureID[i-1]).push_back(i);
+      break;
+    case 2:
+      for(int j=1;j<=jMax;j++)
+       for(int i=1;i<=iMax;i++){
+         (theMesh->myObjID2StructureID[iii]).push_back(i);
+         (theMesh->myObjID2StructureID[iii]).push_back(j);
+         iii++;
+       }
+      break;
+    case 3:
+      for(int k=1;k<=kMax ;k++)
+       for(int j=1;j<=jMax;j++)
+         for(int i=1;i<=iMax;i++)
+           {
+             (theMesh->myObjID2StructureID[iii]).push_back(i);
+             (theMesh->myObjID2StructureID[iii]).push_back(j);
+             (theMesh->myObjID2StructureID[iii]).push_back(k);
+             iii++;
+           }
+    }
+    //ENK: 23.11.2006
+    
     for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
       const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
       const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
       
-      TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
+      VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+      VISU::PMEDMeshOnEntity aMeshOnEntity = 
+       aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
       aMeshOnEntity->myEntity = aVEntity;
       aMeshOnEntity->myMeshName = aMeshName;
       aMeshOnEntity->myGeom2Size = aGeom2Size;
-//       TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+      VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
 
       INITMSG(MYDEBUG,
              "- aMEntity = "<<aMEntity<<
@@ -656,12 +716,12 @@ namespace
        aMeshOnEntity->myNbCells = theGrilleInfo->GetNbNodes();
        aMeshOnEntity->myCellsSize = 2*theGrilleInfo->GetNbNodes();
 
-       // must be implemented (shadow point for GRILLE STANDARD,CARTESIAN,...)
-//     for(TInt iElem = 0; iElem < theMesh->myNbPoints; iElem++){
-//       TInt aFamId = theNodeInfo->GetFamNum(iElem);
-//       if(aFamId != 0)
-//         aFamilyID2CellsSize[aFamId] += 2;
-//     }
+       if((theGrilleInfo->myFamNumNode).size() > 0)
+       for(TInt iElem = 0; iElem < theGrilleInfo->GetNbNodes(); iElem++){
+         TInt aFamId = theGrilleInfo->GetFamNumNode(iElem);
+         if(aFamId != 0)
+           aFamilyID2CellsSize[aFamId] += 2;
+       }
        
        INITMSG(MYDEBUG,
                "- myNbCells = "<<aMeshOnEntity->myNbCells<<
@@ -676,7 +736,7 @@ namespace
          const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
          VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
          vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
-         TInt aNbElem = theGrilleInfo->GetNbCells();
+         TInt aNbElem = aGeom2SizeIter->second;//theGrilleInfo->GetNbCells();
          aMeshOnEntity->myNbCells += aNbElem;
          aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
          
@@ -687,35 +747,37 @@ namespace
                  "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
                  endl);
          
-//       for(TInt iElem = 0; iElem < aNbElem; iElem++){
-//         TInt aFamId = aCellInfo->GetFamNum(iElem);
-//         if(aFamId != 0)
-//           aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
-//       }
+         if((theGrilleInfo->myFamNum).size() > 0)
+         for(TInt iElem = 0; iElem < aNbElem; iElem++){
+           TInt aFamId = theGrilleInfo->GetFamNum(iElem);
+           if(aFamId != 0)
+             aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
+         }
        }
-       
       }
-
     }
-
-    
   }
 
 
   //---------------------------------------------------------------
   void
-  BuildFieldMap(PMEDMesh theMesh,
+  BuildFieldMap(VISU::PMEDMesh theMesh,
                const MED::TEntityInfo& theEntityInfo,
                MED::PWrapper theMEDWrapper)
   {
-    TTimerLog aTimerLog(MYDEBUG,"BuildFieldMap");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFieldMap");
     TInt aNbFields = theMEDWrapper->GetNbFields(); 
     MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
     const std::string& aMeshName = theMesh->myName;
     INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<<aNbFields<<"\n");
     for(TInt iField = 1; iField <= aNbFields; iField++){
-      TTimerLog aTimerLog(MYDEBUG,"GetPFieldInfo");
-      MED::PFieldInfo aFieldInfo = theMEDWrapper->GetPFieldInfo(aMeshInfo,iField);
+      VISU::TTimerLog aTimerLog(MYDEBUG,"GetPFieldInfo");
+      
+      MED::TErr anError = 0;
+      MED::PFieldInfo aFieldInfo = theMEDWrapper->GetPFieldInfo(aMeshInfo, iField, &anError);
+      if ( anError < 0 )
+       continue;
+
       TInt aNbComp = aFieldInfo->GetNbComp();
       std::string aFieldName = aFieldInfo->GetName();
       
@@ -728,12 +790,20 @@ namespace
       if(aNbTimeStamps < 1)
        continue;
       
-      TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
-      TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
-      PMEDField aField = aFieldMap[aFieldName](new TMEDField());
+      VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+      vtkIdType aDataType = VTK_DOUBLE;
+      if(aFieldInfo->GetType() != MED::eFLOAT64){
+#if defined(HAVE_F77INT64)
+       aDataType = VTK_LONG;
+#else  
+       aDataType = VTK_INT;
+#endif
+      }
+      VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
+      VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+      VISU::PMEDField aField = aFieldMap[aFieldName](new VISU::TMEDField());
       aField->myId = iField;
-      aField->InitArrays(aNbComp);
+      aField->Init(aNbComp, aDataType);
       aField->myEntity = aVEntity;
       aField->myName = aFieldName;
       aField->myMeshName = aMeshName;
@@ -751,16 +821,22 @@ namespace
       }
       
       for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
-       TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo");
+       VISU::TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo");
+
+       MED::TErr anError = 0;
        MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo,
                                                                              aMEntity,
                                                                              aGeom2Size,
-                                                                             iTimeStamp);
+                                                                             iTimeStamp,
+                                                                             &anError);
+       if ( anError < 0 )
+         continue;
+
        TFloat aDt = aTimeStampInfo->GetDt();
        std::string anUnitDt = aTimeStampInfo->GetUnitDt();
 
-       TValField& aValField = aField->myValField;
-       PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
+       VISU::TValField& aValField = aField->myValField;
+       VISU::PMEDValForTime aValForTime = aValField[iTimeStamp](new VISU::TMEDValForTime());
        aValForTime->myId = iTimeStamp;
        aValForTime->myFieldName = aField->myName;
        aValForTime->myEntity = aField->myEntity;
@@ -768,12 +844,12 @@ namespace
        aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
        INITMSG(MYDEBUG,"aDt = '"<<aDt<<", "<<anUnitDt<<"'\n");
        
-       TGeom2NbGauss& aVGeom2NbGauss = aValForTime->myGeom2NbGauss;
+       VISU::TGeom2NbGauss& aVGeom2NbGauss = aValForTime->myGeom2NbGauss;
        const MED::TGeom2NbGauss& aMGeom2NbGauss = aTimeStampInfo->myGeom2NbGauss;
        MED::TGeom2NbGauss::const_iterator anIter = aMGeom2NbGauss.begin();
        for(; anIter != aMGeom2NbGauss.end(); anIter++){
          const MED::EGeometrieElement& aMGeom = anIter->first;
-         EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+         VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
          TInt aNbGauss = anIter->second;
          aVGeom2NbGauss[aEGeom] = aNbGauss;
        }
@@ -784,13 +860,13 @@ namespace
 
   //---------------------------------------------------------------
   void
-  BuildFamilyMap(PMEDMesh theMesh,
+  BuildFamilyMap(VISU::PMEDMesh theMesh,
                 const MED::TEntityInfo& theEntityInfo,
                 const MED::TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
                 const MED::TFamilyInfoSet& theFamilyInfoSet,
                 MED::PWrapper theMEDWrapper)
   {
-    TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap");
     INITMSG(MYDEBUG,"BuildFamilyMap\n");
 
     MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
@@ -800,10 +876,10 @@ namespace
       const MED::EEntiteMaillage& aMEntity = aEntity2FamilySetIter->first;
       const MED::TFamilyTSizeSet& aFamilyTSizeSet = aEntity2FamilySetIter->second;
       
-      TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
-      const TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
-      TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+      VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+      VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
+      const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+      VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
        
       if(aFamilyTSizeSet.empty())
        continue;
@@ -824,14 +900,14 @@ namespace
        
        std::string aFamilyName = aFamilyInfo->GetName();
 
-       PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
+       VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
        aFamily->myId = anId;
        aFamily->myEntity = aVEntity;
        aFamily->myName = aFamilyName;
        aFamily->myNbCells = aSize;
 
        aFamily->myCellsSize = 0;
-       TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId);
+       VISU::TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId);
        if(anIter != aFamilyID2CellsSize.end())
          aFamily->myCellsSize = anIter->second;
        
@@ -856,24 +932,94 @@ namespace
     }
   }
 
+  
+  /*!
+   * Build grille family map
+   */
+  void
+  BuildGrilleFamilyMap(VISU::PMEDMesh theMesh,
+                      const MED::TEntityInfo& theEntityInfo,
+                      const MED::TFamilyInfoSet& theFamilyInfoSet,
+                      MED::PWrapper theMEDWrapper)
+  {
+    VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGrilleFamilyMap");
+    INITMSG(MYDEBUG,"BuildGrilleFamilyMap\n");
+    
+    VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+
+    MED::TEntityInfo::const_iterator aEntityIter = theEntityInfo.begin();
+
+    const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+    MED::PGrilleInfo aGrilleInfo = theMEDWrapper->GetPGrilleInfo(aMeshInfo);
+
+    const MED::TFamilyID2NbCells& aFam2NbCells = MED::GetFamilyID2NbCells(aGrilleInfo);
+
+    MED::TFamilyInfoSet::const_iterator aFamInter = theFamilyInfoSet.begin();
+    for(; aFamInter != theFamilyInfoSet.end(); aFamInter++){
+      const MED::PFamilyInfo& aFamilyInfo = *aFamInter;
+      TInt anId = aFamilyInfo->GetId();
+
+      if(anId == 0)
+       continue;
+
+      std::string aFamilyName = aFamilyInfo->GetName();
+      const MED::EEntiteMaillage& aMEntity = MED::GetEntityByFamilyId(aGrilleInfo,
+                                                                     anId);
+      VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+
+      VISU::PMEDMeshOnEntity aMeshOnEntity;
+      VISU::TMeshOnEntityMap::iterator aMeshOnEntityIter = aMeshOnEntityMap.find(aVEntity);
+      if(aMeshOnEntityIter != aMeshOnEntityMap.end())
+       aMeshOnEntity = aMeshOnEntityIter->second;
+
+      VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+
+      VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
+      aFamily->myId = anId;
+      aFamily->myEntity = aVEntity;
+      aFamily->myName = aFamilyName;
+      aFamily->myNbCells = 0;
+      aFamily->myCellsSize = 0;
+
+      const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+      VISU::TFamilyID2CellsSize::const_iterator aFamilyid2CellsSizeIter = aFamilyID2CellsSize.find(anId);
+      if(aFamilyid2CellsSizeIter != (aMeshOnEntity->myFamilyID2CellsSize).end())
+       aFamily->myCellsSize = aFamilyid2CellsSizeIter->second;
+      MED::TFamilyID2NbCells::const_iterator aFam2NbCellsIter = aFam2NbCells.find(anId);
+      if(aFam2NbCellsIter != aFam2NbCells.end())
+       aFamily->myNbCells = aFam2NbCellsIter->second;
+
+      INITMSG(MY_FAMILY_DEBUG,
+             "- aFamilyName =|"<<aFamily->myName<<"|"
+             << "; myId = "<<aFamily->myId
+             << "; aNbAttr = "<<aFamilyInfo->GetNbAttr()
+             << "; aNbGroup = "<<aFamilyInfo->GetNbGroup()
+             << "; aVEntity = "<<aVEntity
+             << "; myNbCells = "<<aFamily->myNbCells
+             << "; myCellsSize = "<<aFamily->myCellsSize
+             <<endl);
+
+
+    }
+  }
 
   //---------------------------------------------------------------
   void
-  BuildGroupMap(PMEDMesh theMesh,
+  BuildGroupMap(VISU::PMEDMesh theMesh,
                const MED::TFamilyInfoSet& theFamilyInfoSet)
   {
-    TTimerLog aTimerLog(MYDEBUG,"BuildGroupMap");
+    VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroupMap");
     INITMSG(MYDEBUG,"BuildGroupMap\n");
 
-    TGroupMap& aGroupMap = theMesh->myGroupMap;
+    VISU::TGroupMap& aGroupMap = theMesh->myGroupMap;
     MED::TGroupInfo aGroupInfo = MED::GetGroupInfo(theFamilyInfoSet);
     MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
     for(; aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
       const std::string& aGroupName = aGroupInfoIter->first;
       INITMSG(MY_GROUP_DEBUG,"aGroupName = '"<<aGroupName<<"'\n");
 
-      PMEDGroup aGroup(new TMEDGroup());
-      TFamilySet& aFamilySet = aGroup->myFamilySet;
+      VISU::PMEDGroup aGroup(new VISU::TMEDGroup());
+      VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
 
       const MED::TFamilyInfoSet& aFamilyInfoSet = aGroupInfoIter->second;
       MED::TFamilyInfoSet::const_iterator aFamilyIter = aFamilyInfoSet.begin();
@@ -881,20 +1027,20 @@ namespace
        const MED::PFamilyInfo& aFamilyInfo = *aFamilyIter;
        std::string aFamilyName = aFamilyInfo->GetName();
        
-       TEntity aVEntity = TEntity(-1);
-       PMEDFamily aFamily;
+       VISU::TEntity aVEntity = VISU::TEntity(-1);
+       VISU::PMEDFamily aFamily;
        
        // Find aVisuEntity
-       const TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
-       TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
+       const VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+       VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
        for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
-         const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
-         const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
-         TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+         const VISU::PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
+         const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+         VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
          for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
            const std::string& aName = aFamilyMapIter->first;
-           aFamily = aFamilyMapIter->second;
            if(aName == aFamilyName){
+              aFamily = aFamilyMapIter->second;
              aVEntity = aFamily->myEntity;
              goto exit_lable;
            }
@@ -915,51 +1061,179 @@ namespace
   }
 
 
+  //---------------------------------------------------------------
+  struct TSetIsDone
+  {
+    bool& myIsDone;
+    TSetIsDone(bool& theIsDone):
+      myIsDone(theIsDone)
+    {}
+
+    ~TSetIsDone()
+    {
+      myIsDone = true;
+    }
+
+  };
+
+
+  //---------------------------------------------------------------
+}
+
+namespace VISU
+{
   //---------------------------------------------------------------
   void
   TMEDNamedPointCoords
-  ::Init(vtkIdType theNbPoints,
-        vtkIdType theDim,
-        const MED::PNodeInfo& theNodeInfo)
+  ::Init(const MED::PNodeInfo& theNodeInfo,
+        MED::EVersion theVersion)
   {
+    TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder();
+    TInt aNbElem = theNodeInfo->GetNbElem();
+    TInt aDim = theNodeInfo->GetMeshInfo()->GetDim();
+    aCoordHolder->Init(aNbElem, aDim, theNodeInfo->myCoord);
+    TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
+    myVersion = theVersion;
+
+    for(TInt iDim = 0; iDim < aDim; iDim++)
+      myPointsDim[iDim] = theNodeInfo->GetCoordName(iDim);
+      
+    myIsElemNum = theNodeInfo->IsElemNum();
     if(theNodeInfo->IsElemNum())
-      TNamedPointCoords::Init(theNbPoints,theDim,theNodeInfo->myElemNum);
-    else
-      TNamedPointCoords::Init(theNbPoints,theDim);
+      myElemNum = theNodeInfo->myElemNum;
+
+    myIsElemNames = theNodeInfo->IsElemNames();
     if(theNodeInfo->IsElemNames())
-      myNodeInfo = theNodeInfo;
+      myElemNames = theNodeInfo->myElemNames;
   }
 
   void
   TMEDNamedPointCoords
-  ::Init(vtkIdType theNbPoints,
-        vtkIdType theDim,
-        const MED::PGrilleInfo& theInfo)
+  ::Init(const MED::PGrilleInfo& theGrilleInfo)
   {
-    TNamedPointCoords::Init(theNbPoints,theDim);
+    TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder();
+    TInt aNbElem = theGrilleInfo->GetNbNodes();
+    TInt aDim = theGrilleInfo->GetMeshInfo()->GetDim();
+    MED::PNodeCoord aCoord(new MED::TNodeCoord(aNbElem * aDim));
+    aCoordHolder->Init(aNbElem, aDim, aCoord);
+    TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
+
+    for(TInt iDim = 0; iDim < aDim; iDim++)
+      myPointsDim[iDim] = theGrilleInfo->GetCoordName(iDim);
+
+    for(TInt iElem = 0; iElem < aNbElem; iElem++){
+      VISU::TCoordSlice aVCoordSlice = GetCoordSlice(iElem);
+      MED::TNodeCoord aMCoord = theGrilleInfo->GetCoord(iElem);
+      for(TInt iDim = 0; iDim < aDim; iDim++){
+       aVCoordSlice[iDim] = aMCoord[iDim];
+      }
+    }
+  }
+
+  vtkIdType
+  TMEDNamedPointCoords
+  ::GetObjID(vtkIdType theID) const
+  {
+    if(myIsElemNum)
+      return (*myElemNum)[theID];
+    return TNamedPointCoords::GetObjID(theID);
+  }
+
+
+  vtkIdType
+  TMEDNamedPointCoords
+  ::GetVTKID(vtkIdType theID) const
+  {
+    if(myIsElemNum){
+      // To prepare corresponding mapper engine
+      if(myObj2VTKID.empty()){
+       vtkIdType anEnd = myElemNum->size();
+       for(vtkIdType anID = 0; anID < anEnd; anID++)
+         myObj2VTKID[(*myElemNum)[anID]] = anID;
+      }
+      TObj2VTKID::const_iterator anIter = myObj2VTKID.find(theID);
+      if(anIter != myObj2VTKID.end())
+       return anIter->second;
+      return -1;
+    }
+    return TNamedPointCoords::GetVTKID(theID);
+  }
+
+  MED::TInt
+  GetPNOMLength(MED::EVersion theVersion)
+  {
+    if(theVersion == MED::eV2_1)
+      return MED::GetPNOMLength<MED::eV2_1>();
+    return MED::GetPNOMLength<MED::eV2_2>();
   }
 
   std::string 
   TMEDNamedPointCoords
   ::GetNodeName(vtkIdType theObjID) const
   {
-    if(myNodeInfo)
-      return myNodeInfo->GetElemName(theObjID);
+    if(myIsElemNames)
+      return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames);
     return TNamedPointCoords::GetNodeName(theObjID);
   }
 
+  unsigned long int
+  TMEDNamedPointCoords
+  ::GetMemorySize()
+  {
+    size_t aSize = TNamedPointCoords::GetMemorySize();
+
+    if(myElemNum){
+      aSize += myObj2VTKID.size() * sizeof(vtkIdType) * 2;
+      aSize += myElemNum->size() * sizeof(MED::TInt);
+    }
+
+    if(myIsElemNames)
+      aSize += myElemNames->size() * sizeof(char);
+    return aSize;
+  }
+
 
   //---------------------------------------------------------------
   vtkIdType
   TMEDSubProfile
   ::GetElemObjID(vtkIdType theID) const
   {
-    if(myIsElemNum)
-      return myElemNum[theID];
+    if ( !mySubMeshID.empty() )
+      theID = mySubMeshID[theID];
+
+    if (myIsElemNum)
+      return (*myElemNum)[theID];
     else
       return theID;
   }
   
+//---------------------------------------------------------------
+  vtkIdType
+  TMEDSubProfile
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    if ( myIsElemNum )
+      for ( size_t anId = 0; anId < (*myElemNum).size(); anId++ ) 
+       if ( (*myElemNum)[ anId ] == theID ) {
+         theID = anId;
+         break;
+       }
+
+    return TSubProfileImpl::GetElemVTKID( theID );
+  }
+
+//----------------------------------------------------------------
+
+  unsigned long int
+  TMEDSubProfile
+  ::GetMemorySize()
+  {
+    size_t aSize = TSubProfileImpl::GetMemorySize();
+    if(myIsElemNum)
+      aSize += myElemNum->size() * sizeof(MED::TInt);
+    return aSize;
+  }
+
 
   //---------------------------------------------------------------
   void
@@ -981,50 +1255,84 @@ namespace
   //---------------------------------------------------------------
   TGaussPointID
   TMEDGaussSubMesh
-  ::GetObjID(vtkIdType theID,
+  ::GetObjID(vtkIdType theID) const
+  {
+    vtkIdType aNbPoints = myGauss->myNbPoints;
+    TCellID aCellID = theID / aNbPoints;
+    TLocalPntID aLocalPntID = theID % aNbPoints;
+
+    if ( myIsElemNum )
+      aCellID = GetElemObjID(aCellID);
+    else
+      aCellID += myStartID;
+
+    return TGaussPointID(aCellID, aLocalPntID);
+  }
+  
+ //---------------------------------------------------------------
+  vtkIdType
+  TMEDGaussSubMesh
+  ::GetVTKID(const TGaussPointID& theID,
             vtkIdType theStartID) const
   {
-    TCellID aCellID = theID / myGauss->myNbPoints;
-    TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
+    vtkIdType aResult = -1;
+
+    TCellID aCellID = theID.first;
+    TLocalPntID aLocalPntID = theID.second;
     
-    if(myIsElemNum)
-      aCellID = myElemNum[aCellID];
-    else
-      aCellID += theStartID;
+    vtkIdType aNbPoints = myGauss->myNbPoints;
+    if ( aLocalPntID >= aNbPoints )
+      return aResult;
+    
+    if ( myIsElemNum ) {
+      aCellID = GetElemVTKID( aCellID );
+    } else
+      aCellID -= theStartID;
 
-    return TGaussPointID(aCellID,aLocalPntID);
+    return aCellID * aNbPoints + aLocalPntID + theStartID;
   }
+
+
+  //---------------------------------------------------------------
   
+  unsigned long int
+  TMEDGaussSubMesh
+  ::GetMemorySize()
+  {
+    size_t aSize = TGaussSubMeshImpl::GetMemorySize();
+    if(myIsElemNum)
+      aSize += myElemNum->size() * sizeof(MED::TInt);
+    return aSize;
+  }
+
 
   //---------------------------------------------------------------
   void
   TMEDSubMesh
-  ::Init(const MED::PElemInfo& theElemInfo)
+  ::Init(const MED::PElemInfo& theElemInfo,
+        MED::EVersion theVersion)
   {
     myIsElemNum = theElemInfo->IsElemNum();
-
     if(myIsElemNum)
       myElemNum = theElemInfo->myElemNum;
 
+    myIsElemNames = theElemInfo->IsElemNames();
     if(theElemInfo->IsElemNames())
-      myElemInfo = theElemInfo;
+      myElemNames = theElemInfo->myElemNames;
   }
 
 
   void
   TMEDSubMesh
   ::Init(const MED::PGrilleInfo& theGrilleInfo)
-  {
-    myIsElemNum = MED::eFAUX;
-    // must be implemented
-  }
+  {}
 
   vtkIdType
   TMEDSubMesh
   ::GetElemObjID(vtkIdType theID) const
   {
     if(myIsElemNum)
-      return myElemNum[theID];
+      return (*myElemNum)[theID];
     else
       return TSubMeshImpl::GetElemObjID(theID);
   }
@@ -1033,46 +1341,50 @@ namespace
   TMEDSubMesh
   ::GetElemName(vtkIdType theObjID) const
   {
-    if(myElemInfo)
-      return myElemInfo->GetElemName(theObjID);
+    if(myIsElemNames)
+      return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames);
     return TSubMeshImpl::GetElemName(theObjID);
   }
 
-  struct TSetIsDone
+  unsigned long int
+  TMEDSubMesh
+  ::GetMemorySize()
   {
-    bool& myIsDone;
-    TSetIsDone(bool& theIsDone):
-      myIsDone(theIsDone)
-    {}
+    size_t aSize = TSubMeshImpl::GetMemorySize();
 
-    ~TSetIsDone()
-    {
-      myIsDone = true;
-    }
+    if(myIsElemNum)
+      aSize += myElemNum->size() * sizeof(MED::TInt);
 
-  };
+    if(myIsElemNames)
+      aSize += myElemNames->size() * sizeof(char);
+
+    return aSize;
+  }
+
+
+  //---------------------------------------------------------------
 }
 
 
 //---------------------------------------------------------------
 extern "C"
 VISU_Convertor* 
-CreateConvertor(const string& theFileName)
+CreateConvertor(const std::string& theFileName)
 {
   if(MED::PWrapper aMed = MED::CrWrapper(theFileName,true))
-    return new VISU_MedConvertor(theFileName);
+    return new VISU_MedConvertor(theFileName, aMed);
   return NULL;
 }
 
 VISU_MedConvertor
-::VISU_MedConvertor(const string& theFileName):
+::VISU_MedConvertor(const std::string& theFileName, MED::PWrapper theMed):
   myIsEntitiesDone(false),
   myIsFieldsDone(false),
   myIsGroupsDone(false),
-  myIsMinMaxDone(false)
+  myIsMinMaxDone(false),
+  myMed(theMed)
 {
-  myFileInfo.setFile(QString(theFileName.c_str()));
-  myName = myFileInfo.baseName().latin1();
+  myName = theFileName;
 }
 
 
@@ -1085,11 +1397,10 @@ VISU_MedConvertor
     return this;
 
   TSetIsDone aSetIsDone(myIsEntitiesDone);
-  TTimerLog aTimerLog(MYDEBUG,"BuildEntities");
-  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+  VISU::TTimerLog aTimerLog(MYDEBUG,"BuildEntities");
 
-  TInt aNbMeshes = aMed->GetNbMeshes();
-  TMeshMap& aMeshMap = myMeshMap;
+  TInt aNbMeshes = myMed->GetNbMeshes();
+  VISU::TMeshMap& aMeshMap = myMeshMap;
 
   INITMSG(MYDEBUG,"BuildEntities aNbMeshes = "<<aNbMeshes<<"\n");
 
@@ -1097,28 +1408,28 @@ VISU_MedConvertor
 #ifndef _DEXCEPT_
     try{
 #endif
-      TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+      VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
 
-      MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+      MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
       std::string aMeshName = aMeshInfo->GetName();
       TInt aDim = aMeshInfo->GetDim();
       MED::EMaillage aType = aMeshInfo->GetType();
        
       // creating TMesh structure and TMeshOnEntityMap         
-      PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
+      VISU::PMEDMesh aMesh = aMeshMap[aMeshName](new VISU::TMEDMesh());
       
       aMesh->myDim = aDim;
       aMesh->myName = aMeshName;
       aMesh->myMeshInfo = aMeshInfo;
-      aMesh->myNamedPointCoords(new TMEDNamedPointCoords());
+      aMesh->myNamedPointCoords(new VISU::TMEDNamedPointCoords());
       
       INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
              "; aDim = "<<aDim<<"\n");
 
       if(aType == MED::eNON_STRUCTURE){
 
-       if(MED::PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo)){
-         MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+       if(MED::PNodeInfo aNodeInfo = myMed->GetPNodeInfo(aMeshInfo)){
+         MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
 
          aMesh->myNbPoints = aNodeInfo->GetNbElem();
          aMesh->myEntityInfo = anEntityInfo;
@@ -1134,7 +1445,7 @@ VISU_MedConvertor
            BuildMeshOnEntityMap(aMesh,
                                 anEntityInfo,
                                 aNodeInfo,
-                              aMed);
+                                myMed);
            
 #ifndef _DEXCEPT_
          }catch(std::exception& exc){
@@ -1146,7 +1457,7 @@ VISU_MedConvertor
        }
       } // NON STRUCTURED MESH
       else {
-       MED::PGrilleInfo aGrilleInfo = aMed->GetPGrilleInfo(aMeshInfo);
+       MED::PGrilleInfo aGrilleInfo = myMed->GetPGrilleInfo(aMeshInfo);
 
        MED::TEntityInfo anEntityInfo;
        anEntityInfo[MED::eNOEUD][MED::ePOINT1] = aGrilleInfo->GetNbNodes();
@@ -1154,7 +1465,10 @@ VISU_MedConvertor
        
        aMesh->myNbPoints   = aGrilleInfo->GetNbNodes();
        aMesh->myEntityInfo = anEntityInfo;
-
+       //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
+       aMesh->myIsStructured = true;
+       aMesh->myType         = (MED::eGRILLE_POLAIRE == aGrilleInfo->GetGrilleType());
+       //ENK: 23.11.2006
 #ifndef _DEXCEPT_
        try{
 #endif
@@ -1163,7 +1477,7 @@ VISU_MedConvertor
          BuildMeshGrilleOnEntityMap(aMesh,
                                     anEntityInfo,
                                     aGrilleInfo,
-                                    aMed);
+                                    myMed);
          
 #ifndef _DEXCEPT_
        }catch(std::exception& exc){
@@ -1196,12 +1510,13 @@ VISU_MedConvertor
   if(myIsFieldsDone)
     return this;
 
+  VISU_Convertor_impl::BuildFields();
+
   TSetIsDone aSetIsDone(myIsFieldsDone);
-  TTimerLog aTimerLog(MYDEBUG,"BuildFields");
-  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+  VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFields");
 
-  TInt aNbMeshes = aMed->GetNbMeshes();
-  TMeshMap& aMeshMap = myMeshMap;
+  TInt aNbMeshes = myMed->GetNbMeshes();
+  VISU::TMeshMap& aMeshMap = myMeshMap;
 
   INITMSG(MYDEBUG,"BuildFields - aNbMeshes = "<<aNbMeshes<<"\n");
 
@@ -1209,25 +1524,25 @@ VISU_MedConvertor
 #ifndef _DEXCEPT_
     try{
 #endif
-      TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+      VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
 
-      MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+      MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
       std::string aMeshName = aMeshInfo->GetName();
       
-      TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+      VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
       if(anIter == aMeshMap.end())
        continue;
-      PMEDMesh aMesh = anIter->second;
+      VISU::PMEDMesh aMesh = anIter->second;
 
       INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
 #ifndef _DEXCEPT_
       try{
 #endif
-       MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+       MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
 
        BuildFieldMap(aMesh,
                      anEntityInfo,
-                     aMed);
+                     myMed);
 #ifndef _DEXCEPT_
       }catch(std::exception& exc){
        MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
@@ -1249,6 +1564,72 @@ VISU_MedConvertor
 }
 
 
+//---------------------------------------------------------------
+template<class TimeStampValueType>
+void
+BuildTimeStampMinMax(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
+                    const MED::TGeom2Gauss& theGeom2Gauss,
+                    VISU::TMinMaxArr& theMinMaxArr,
+                    TInt theNbComp,
+                    TInt theNbComp2)
+{
+  const typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
+  typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
+  for(; anIter != aGeom2Value.end(); anIter++){
+    const typename TimeStampValueType::TTMeshValue& aMMeshValue = anIter->second;
+    MED::EGeometrieElement aMGeom = anIter->first;
+                 
+    TInt aNbElem = aMMeshValue.myNbElem;
+    TInt aNbGauss = aMMeshValue.myNbGauss;
+                 
+    MED::TGeom2Gauss::const_iterator aGaussIter = theGeom2Gauss.find(aMGeom);
+    if(aGaussIter == theGeom2Gauss.end())
+      aNbGauss = 1;
+                 
+    INITMSG(MYDEBUG,
+           "- aMGeom = "<<aMGeom<<
+           "; aNbElem = "<<aNbElem<<
+           "; aNbGauss = "<<aNbGauss<<
+           endl);
+                 
+    // To calculate min/max per components
+    for(TInt iElem = 0; iElem < aNbElem; iElem++){
+      typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
+      for(TInt iComp = 0; iComp < theNbComp; iComp++){
+       const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
+       VISU::TMinMax& aMinMax = theMinMaxArr[iComp+1];
+       vtkFloatingPointType& aMin = aMinMax.first;
+       vtkFloatingPointType& aMax = aMinMax.second;
+       for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+         const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
+         aMin = min(aMin,aVal);
+         aMax = max(aMax,aVal);
+       }
+      }
+    }
+                 
+    // To calculate min/max per vector modulus
+    VISU::TMinMax& aMinMax = theMinMaxArr[0];
+    vtkFloatingPointType& aMin = aMinMax.first;
+    vtkFloatingPointType& aMax = aMinMax.second;
+    for(TInt iElem = 0; iElem < aNbElem; iElem++){
+      typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
+      for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+       const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
+       vtkFloatingPointType aValue = 0.0;
+       for(TInt iComp = 0; iComp < theNbComp2; iComp++){
+         vtkFloatingPointType aVal = aMValueSlice[iComp];
+         aValue += aVal*aVal;
+       }
+       aValue = sqrt(aValue);
+       aMin = min(aMin,aValue);
+       aMax = max(aMax,aValue);
+      }
+    }
+  }
+}
+
+  
 //---------------------------------------------------------------
 VISU_Convertor* 
 VISU_MedConvertor
@@ -1257,15 +1638,16 @@ VISU_MedConvertor
   if(myIsMinMaxDone)
     return this;
 
+  VISU_Convertor_impl::BuildMinMax();
+
   TSetIsDone aSetIsDone(myIsMinMaxDone);
-  TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
-  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+  VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
 
-  MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(aMed);
-  MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(aMed);
+  MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(myMed);
+  MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(myMed);
 
-  TInt aNbMeshes = aMed->GetNbMeshes();
-  TMeshMap& aMeshMap = myMeshMap;
+  TInt aNbMeshes = myMed->GetNbMeshes();
+  VISU::TMeshMap& aMeshMap = myMeshMap;
 
   INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<<aNbMeshes<<"\n");
 
@@ -1273,46 +1655,51 @@ VISU_MedConvertor
 #ifndef _DEXCEPT_
     try{
 #endif
-      TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
+      VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
 
-      MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+      MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
       std::string aMeshName = aMeshInfo->GetName();
       
-      TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+      VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
       if(anIter == aMeshMap.end())
        continue;
-      PMEDMesh aMesh = anIter->second;
+      VISU::PMEDMesh aMesh = anIter->second;
 
 #ifndef _DEXCEPT_
       try{
 #endif
-       TInt aNbFields = aMed->GetNbFields(); 
+       TInt aNbFields = myMed->GetNbFields(); 
 
        INITMSG(MYDEBUG,
                "- aMeshName = '"<<aMeshName<<"'"<<
                "; aNbFields = "<<aNbFields<<"\n");
 
-       MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+       MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
 
        for(TInt iField = 1; iField <= aNbFields; iField++){
-         TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
-         MED::PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
+         VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
+
+         MED::TErr anError = 0;
+         MED::PFieldInfo aFieldInfo = myMed->GetPFieldInfo(aMeshInfo, iField, &anError);
+         if ( anError < 0 )
+           continue;
+
          std::string aFieldName = aFieldInfo->GetName();
          INITMSG(MYDEBUG,"- aFieldName = '"<<aFieldName<<"'\n");
          
          MED::TGeom2Size aGeom2Size;
          MED::EEntiteMaillage aMEntity;
-         TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,
+         TInt aNbTimeStamps = myMed->GetNbTimeStamps(aFieldInfo,
                                                     anEntityInfo,
                                                     aMEntity,
                                                     aGeom2Size);
          if(aNbTimeStamps < 1)
            continue;
        
-         TEntity aVEntity = MEDEntityToVTK(aMEntity);
-         PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
-         TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
-         PMEDField aField = aFieldMap[aFieldName];
+         VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+         VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+         VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+         VISU::PMEDField aField = aFieldMap[aFieldName];
        
          TInt aNbComp = aField->myNbComp;
          int aNbComp2 = aNbComp;
@@ -1321,93 +1708,53 @@ VISU_MedConvertor
          else if(aNbComp > 4)
            aNbComp2 = 3;
 
-         TMinMaxArr& aMinMaxArr = aField->myMinMaxArr;
+         VISU::TMinMaxArr& aMinMaxArr = aField->myMinMaxArr;
          TSetIsDone aSetIsDone(aField->myIsMinMaxInitilized);
          for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){
-           TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
+           VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
            INITMSG(MYDEBUG,"- iTimeStamp = "<<iTimeStamp<<endl);
            
 #ifndef _DEXCEPT_
-           CASCatch_TRY{ 
-             try{
+            try {
+#ifdef NO_CAS_CATCH
+              OCC_CATCH_SIGNALS;
 #endif
-               MED::PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo,
-                                                                            aMEntity,
-                                                                            aGeom2Size,
-                                                                            iTimeStamp);
-               
-               MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo,
-                                                                         aMKey2Profile,
-                                                                         aKey2Gauss);
-               
-               const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
-               
-               const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
-               
-               const MED::TGeom2Value& aGeom2Value = aTimeStampValRef.myGeom2Value;
-               MED::TGeom2Value::const_iterator anIter = aGeom2Value.begin();
-               for(; anIter != aGeom2Value.end(); anIter++){
-                 const MED::TMeshValue& aMMeshValue = anIter->second;
-                 MED::EGeometrieElement aMGeom = anIter->first;
-                 
-                 TInt aNbElem = aMMeshValue.myNbElem;
-                 TInt aNbGauss = aMMeshValue.myNbGauss;
-                 
-                 MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
-                 if(aGaussIter == aGeom2Gauss.end())
-                   aNbGauss = 1;
-                 
-                 INITMSG(MYDEBUG,
-                         "- aMGeom = "<<aMGeom<<
-                         "; aNbElem = "<<aNbElem<<
-                         "; aNbGauss = "<<aNbGauss<<
-                         endl);
-                 
-                 // To calculate min/max per components
-                 for(TInt iElem = 0; iElem < aNbElem; iElem++){
-                   MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
-                   for(TInt iComp = 0; iComp < aNbComp; iComp++){
-                     const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
-                     TMinMax& aMinMax = aMinMaxArr[iComp+1];
-                     vtkFloatingPointType& aMin = aMinMax.first;
-                     vtkFloatingPointType& aMax = aMinMax.second;
-                     for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-                       const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
-                       aMin = min(aMin,aVal);
-                       aMax = max(aMax,aVal);
-                     }
-                   }
-                 }
-                 
-                 // To calculate min/max per vector modulus
-                 TMinMax& aMinMax = aMinMaxArr[0];
-                 vtkFloatingPointType& aMin = aMinMax.first;
-                 vtkFloatingPointType& aMax = aMinMax.second;
-                 for(TInt iElem = 0; iElem < aNbElem; iElem++){
-                   MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
-                   for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-                     const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
-                     vtkFloatingPointType aValue = 0.0;
-                     for(TInt iComp = 0; iComp < aNbComp2; iComp++){
-                       vtkFloatingPointType aVal = aMValueSlice[iComp];
-                       aValue += aVal*aVal;
-                     }
-                     aValue = sqrt(aValue);
-                     aMin = min(aMin,aValue);
-                     aMax = max(aMax,aValue);
-                   }
-                 }
-               }
+#endif
+              MED::PTimeStampInfo aTimeStampInfo = 
+                myMed->GetPTimeStampInfo(aFieldInfo,
+                                         aMEntity,
+                                         aGeom2Size,
+                                         iTimeStamp);
+
+              MED::PTimeStampValueBase aTimeStampValue = 
+                myMed->GetPTimeStampValue(aTimeStampInfo,
+                                          aMKey2Profile,
+                                          aKey2Gauss);
+
+              const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
+
+              if(aFieldInfo->GetType() == MED::eFLOAT64)
+                BuildTimeStampMinMax<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
+                                                                aGeom2Gauss,
+                                                                aMinMaxArr,
+                                                                aNbComp,
+                                                                aNbComp2);
+              else
+                BuildTimeStampMinMax<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
+                                                              aGeom2Gauss,
+                                                              aMinMaxArr,
+                                                              aNbComp,
+                                                              aNbComp2);
+
 #ifndef _DEXCEPT_
-             }catch(std::exception& exc){
-               MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
-             }catch(...){
-               MSG(MYDEBUG,"Unknown exception !!!");
-             }
-           }CASCatch_CATCH(Standard_Failure){
-             Handle(Standard_Failure) aFail = Standard_Failure::Caught();          
-             MSG(MYDEBUG,"Follow signal was occured in:\n"<<aFail->GetMessageString());
-           }
+            }catch(Standard_Failure){
+              Handle(Standard_Failure) aFail = Standard_Failure::Caught();          
+              MSG(MYDEBUG,"Follow signal was occured in:\n"<<aFail->GetMessageString());
+            }catch(std::exception& exc){
+              MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+            }catch(...){
+              MSG(MYDEBUG,"Unknown exception !!!");
+            }
 #endif
          }
          for(TInt iComp = 0; iComp <= aNbComp; iComp++){
@@ -1445,11 +1792,10 @@ VISU_MedConvertor
     return this;
 
   TSetIsDone aSetIsDone(myIsGroupsDone);
-  TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
-  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+  VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
 
-  TInt aNbMeshes = aMed->GetNbMeshes();
-  TMeshMap& aMeshMap = myMeshMap;
+  TInt aNbMeshes = myMed->GetNbMeshes();
+  VISU::TMeshMap& aMeshMap = myMeshMap;
 
   INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<<aNbMeshes<<"\n");
 
@@ -1457,33 +1803,41 @@ VISU_MedConvertor
 #ifndef _DEXCEPT_
     try{
 #endif
-      TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+      VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
 
-      MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+      MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
       std::string aMeshName = aMeshInfo->GetName();      
 
-      TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+      VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
       if(anIter == aMeshMap.end())
        continue;
-      PMEDMesh aMesh = anIter->second;
+      VISU::PMEDMesh aMesh = anIter->second;
 
       INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
 
-      MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+      MED::EMaillage aType = aMeshInfo->GetType();
+      
+      MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
       
       MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo = 
-       MED::GetEntity2TGeom2ElemInfo(aMed,aMeshInfo,anEntityInfo);
+       MED::GetEntity2TGeom2ElemInfo(myMed, aMeshInfo, anEntityInfo);
       
 #ifndef _DEXCEPT_
       try{
 #endif
-       MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(aMed,aMeshInfo);
+       MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(myMed, aMeshInfo);
        
-       BuildFamilyMap(aMesh,
-                      anEntityInfo,
-                      anEntity2TGeom2ElemInfo,
-                      aFamilyInfoSet,
-                      aMed);
+       if(aType == MED::eNON_STRUCTURE)
+         BuildFamilyMap(aMesh,
+                        anEntityInfo,
+                        anEntity2TGeom2ElemInfo,
+                        aFamilyInfoSet,
+                        myMed);
+       else
+         BuildGrilleFamilyMap(aMesh,
+                              anEntityInfo,
+                              aFamilyInfoSet,
+                              myMed);
        
        BuildGroupMap(aMesh,
                      aFamilyInfoSet);
@@ -1491,7 +1845,7 @@ VISU_MedConvertor
       }catch(std::exception& exc){
        MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
       }catch(...){
-       MSG(MYDEBUG,"Unknown exception !!!");
+         MSG(MYDEBUG,"Unknown exception !!!");
       }
 #endif
 
@@ -1514,18 +1868,17 @@ VISU_MedConvertor
 ::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
                   VISU::PMeshOnEntityImpl theMeshOnEntity)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
   INITMSG(MYDEBUG,"LoadMeshOnEntity"<<endl);
 
-  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
-  const TEntity& anEntity = theMeshOnEntity->myEntity;
+  const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
 
   int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
-  if(anEntity == NODE_ENTITY){
-    isPointsUpdated += LoadPoints(aMed,theMesh);
+  if(anEntity == VISU::NODE_ENTITY){
+    isPointsUpdated += LoadPoints(myMed, theMesh);
   }else{
-    isPointsUpdated += LoadPoints(aMed,theMesh);
-    isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
+    isPointsUpdated += LoadPoints(myMed, theMesh);
+    isCellsOnEntityUpdated += LoadCellsOnEntity(myMed, theMesh, theMeshOnEntity);
   }
 
   return (isPointsUpdated || isCellsOnEntityUpdated);
@@ -1539,18 +1892,17 @@ VISU_MedConvertor
                     VISU::PMeshOnEntityImpl theMeshOnEntity, 
                     VISU::PFamilyImpl theFamily)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
   INITMSG(MYDEBUG,"LoadFamilyOnEntity"<<endl);
 
-  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
-  const TEntity& anEntity = theMeshOnEntity->myEntity;
+  const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
 
   int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
-  if(anEntity == NODE_ENTITY){
-    isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,theFamily);
+  if(anEntity == VISU::NODE_ENTITY){
+    isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, theFamily);
   }else{
-    isPointsUpdated += LoadPoints(aMed,theMesh);
-    isCellsOnEntityUpdated += LoadCellsOnFamily(aMed,theMesh,theMeshOnEntity,theFamily);
+    isPointsUpdated += LoadPoints(myMed, theMesh);
+    isCellsOnEntityUpdated += LoadCellsOnFamily(myMed, theMesh, theMeshOnEntity, theFamily);
   }
 
   return (isPointsUpdated || isCellsOnEntityUpdated);
@@ -1563,21 +1915,20 @@ VISU_MedConvertor
 ::LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
                  const VISU::TFamilySet& theFamilySet)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
   INITMSG(MYDEBUG,"LoadMeshOnGroup"<<endl);
 
-  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
   int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
-  TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
+  VISU::TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
   for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){
-    PMEDFamily aFamily = *aFamilyIter;
-    const TEntity& anEntity = aFamily->myEntity;
-    const PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
-    isPointsUpdated += LoadPoints(aMed,theMesh);
-    if(anEntity == NODE_ENTITY){
-      isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,aFamily);
+    VISU::PMEDFamily aFamily = *aFamilyIter;
+    const VISU::TEntity& anEntity = aFamily->myEntity;
+    const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
+    isPointsUpdated += LoadPoints(myMed, theMesh);
+    if(anEntity == VISU::NODE_ENTITY){
+      isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, aFamily);
     }else{
-      isCellsOnEntityUpdated += LoadCellsOnFamily(aMed,theMesh,aMeshOnEntity,aFamily);
+      isCellsOnEntityUpdated += LoadCellsOnFamily(myMed,theMesh,aMeshOnEntity,aFamily);
     }
   }
 
@@ -1593,17 +1944,15 @@ VISU_MedConvertor
                       VISU::PFieldImpl theField, 
                       VISU::PValForTimeImpl theValForTime)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
   INITMSG(MYDEBUG,"LoadValForTimeOnMesh"<<endl);
 
-  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
-
-  const TEntity& anEntity = theMeshOnEntity->myEntity;
+  const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
   int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
-  isPointsUpdated += LoadPoints(aMed,theMesh);
-  if(anEntity != NODE_ENTITY)
-    isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
-  int isFieldUpdated = LoadValForTimeOnMesh(aMed,theMesh,theMeshOnEntity,theField,theValForTime);
+  isPointsUpdated += LoadPoints(myMed,theMesh);
+  if(anEntity != VISU::NODE_ENTITY)
+    isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
+  int isFieldUpdated = LoadValForTimeOnMesh(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
   
   return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
 }
@@ -1617,16 +1966,14 @@ VISU_MedConvertor
                           VISU::PFieldImpl theField, 
                           VISU::PValForTimeImpl theValForTime)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
   INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<<endl);
 
-  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
-
-  const TEntity& anEntity = theMeshOnEntity->myEntity;
+  const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
   int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
-  if(anEntity != NODE_ENTITY)
-    isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
-  int isFieldUpdated = LoadValForTimeOnGaussPts(aMed,theMesh,theMeshOnEntity,theField,theValForTime);
+  if(anEntity != VISU::NODE_ENTITY)
+    isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
+  int isFieldUpdated = LoadValForTimeOnGaussPts(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
   
   return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
 }
@@ -1638,12 +1985,12 @@ VISU_MedConvertor
 ::LoadPoints(const MED::PWrapper& theMed,
             VISU::PMEDMesh theMesh) 
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadPoints");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPoints");
   try{
     //Check on existing family
-    PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
+    VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
     aMeshOnEntity->myMeshName = theMesh->myName;
-    aMeshOnEntity->myEntity = NODE_ENTITY;
+    aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
 
     INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<<theMesh->myIsDone<<"'\n");
 
@@ -1657,30 +2004,18 @@ VISU_MedConvertor
       //Main part of code
       MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
       TInt aNbElem = aNodeInfo->GetNbElem();
-      TInt aDim = theMesh->myDim;
-      
-      PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
-      TMEDNamedPointCoords& aCoords = aNamedPointCoords;
-      aCoords.Init(aNbElem,aDim,aNodeInfo);
       
-      for(int iDim = 0; iDim < aDim; iDim++)
-       aCoords.GetName(iDim) = aNodeInfo->GetCoordName(iDim);
+      VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
+      aNamedPointCoords->Init(aNodeInfo, theMed->GetVersion());
       
-      for(int iElem = 0; iElem < aNbElem; iElem++){
-       TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem);
-       MED::TCCoordSlice aMCoordSlice = aNodeInfo->GetCoordSlice(iElem);
-       for(int iDim = 0; iDim < aDim; iDim++)
-         aVCoordSlice[iDim] = aMCoordSlice[iDim];
-      }
+      VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
+      VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
       
-      TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
-      PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TMEDSubMesh());
-      
-      aSubMesh->Init(MED::PElemInfo(aNodeInfo)); 
+      aSubMesh->Init(MED::PElemInfo(aNodeInfo), theMed->GetVersion()); 
       aSubMesh->myNbCells = theMesh->myNbPoints;
       aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
       
-      TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+      VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
       aCell2Connect.resize(aNbElem);
       for (int iElem = 0; iElem < aNbElem; iElem++)
        aCell2Connect[iElem] = VISU::TConnect(1,iElem);
@@ -1689,33 +2024,20 @@ VISU_MedConvertor
       //Main part of code
       MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(theMesh->myMeshInfo);
       TInt aNbElem = aGrilleInfo->GetNbNodes();
-      TInt aDim = theMesh->myDim;
-      
-      PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
-      TMEDNamedPointCoords& aCoords = aNamedPointCoords;
-      aCoords.Init(aNbElem,aDim,aGrilleInfo);
       
-      for(int iDim = 0; iDim < aDim; iDim++)
-       aCoords.GetName(iDim) = aGrilleInfo->GetCoordName(iDim);
+      VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
+      aNamedPointCoords->Init(aGrilleInfo);
       
-      for(int iElem = 0; iElem < aNbElem; iElem++){
-       TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem);
-       MED::TNodeCoord aMCoord = aGrilleInfo->GetCoord(iElem);
-       for(int iDim = 0; iDim < aDim; iDim++){
-         aVCoordSlice[iDim] = aMCoord[iDim];
-       }
-      }
-      
-      TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
-      PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TMEDSubMesh());
+      VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
+      VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
       
       aSubMesh->Init(aGrilleInfo); 
       aSubMesh->myNbCells = theMesh->myNbPoints;
       aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
       
-      TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+      VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
       aCell2Connect.resize(aNbElem);
-      for (int iElem = 0; iElem < aNbElem; iElem++)
+      for(int iElem = 0; iElem < aNbElem; iElem++)
        aCell2Connect[iElem] = VISU::TConnect(1,iElem);
       
     }
@@ -1741,21 +2063,38 @@ VISU_MedConvertor
                     const VISU::PMEDMesh theMesh, 
                     const VISU::PMEDFamily theFamily) 
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
   try{
     if(theFamily->myIsDone) 
       return 0;
 
+    const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+    MED::EMaillage aType = aMeshInfo->GetType();
+
     //Main part of code
-    MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
-    TInt aNbElem = aNodeInfo->GetNbElem();
-
-    if(aNbElem > 0){
-      TInt anId = theFamily->myId;
-      TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
-      for(TInt iElem = 0; iElem < aNbElem; iElem++) 
-       if(aNodeInfo->GetFamNum(iElem) == anId)
-         aSubMeshID.push_back(iElem);
+    if(aType == MED::eNON_STRUCTURE){
+      MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
+      TInt aNbElem = aNodeInfo->GetNbElem();
+      
+      if(aNbElem > 0){
+       TInt anId = theFamily->myId;
+       VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
+       for(TInt iElem = 0; iElem < aNbElem; iElem++) 
+         if(aNodeInfo->GetFamNum(iElem) == anId)
+           aSubMeshID.push_back(iElem);
+      }
+    }
+    else {
+      MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
+      TInt aNbElem = aGrilleInfo->GetNbNodes();
+      
+      if(aNbElem > 0){
+       TInt anId = theFamily->myId;
+       VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
+       for(TInt iElem = 0; iElem < aNbElem; iElem++) 
+         if(aGrilleInfo->GetFamNumNode(iElem) == anId)
+           aSubMeshID.push_back(iElem);
+      }
     }
 
     theFamily->myIsDone = true;
@@ -1779,11 +2118,11 @@ VISU_MedConvertor
                    const VISU::PMEDMesh theMesh,
                    const VISU::PMEDMeshOnEntity theMeshOnEntity)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
 #ifndef _DEXCEPT_
   try{
 #endif
-    const TEntity& aVEntity = theMeshOnEntity->myEntity;
+    const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
     const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
 
     INITMSG(MYDEBUG,"LoadCellsOnEntity - aVEntity = "<<aVEntity<<"\n");
@@ -1805,7 +2144,7 @@ VISU_MedConvertor
       
       const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
       MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
-      TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
+      VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
       
       for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
        const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
@@ -1815,24 +2154,24 @@ VISU_MedConvertor
          vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
          INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
        
-         TInt aNbElem = aGrilleInfo->GetNbCells();
+         TInt aNbElem = aGeom2SizeIter->second;//aGrilleInfo->GetNbCells();
          
          if(aNbElem > 0){
-           PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
+           VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
            
            aSubMesh->Init(aGrilleInfo); 
            aSubMesh->myNbCells = aNbElem;      
            aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
            
-           TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+           VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
            aCell2Connect.resize(aNbElem);
            
            TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
-           TVector<TInt> aConnect(aMNbNodes);
+           VISU::TVector<TInt> aConnect(aMNbNodes);
            
            for(TInt iElem = 0; iElem < aNbElem; iElem++) {
              MED::TIntVector aConn = aGrilleInfo->GetConn(iElem);
-             TConnect& anArray = aCell2Connect[iElem];
+             VISU::TConnect& anArray = aCell2Connect[iElem];
              anArray.resize(aVNbNodes);
              
              if(anIsNodeNum){
@@ -1902,7 +2241,7 @@ VISU_MedConvertor
 
     const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
     MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
-    TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
+    VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
 
     for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
       const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
@@ -1913,19 +2252,19 @@ VISU_MedConvertor
        MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
        TInt aNbElem = aPolygoneInfo->GetNbElem();
        if(aNbElem > 0){
-         PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
+         VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
          
-         aSubMesh->Init(MED::PElemInfo(aPolygoneInfo)); 
+         aSubMesh->Init(MED::PElemInfo(aPolygoneInfo),theMed->GetVersion()); 
          aSubMesh->myNbCells = aNbElem;      
 
-         TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+         VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
          aCell2Connect.resize(aNbElem);
          
          for(TInt iElem = 0; iElem < aNbElem; iElem++) {
            MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
            TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
            aSubMesh->myCellsSize += aNbConn;
-           TConnect& anArray = aCell2Connect[iElem];
+           VISU::TConnect& anArray = aCell2Connect[iElem];
            anArray.resize(aNbConn);
            for(TInt iConn = 0; iConn < aNbConn; iConn++)
              anArray[iConn] = aConnSlice[iConn] - 1;
@@ -1938,17 +2277,17 @@ VISU_MedConvertor
        TInt aNbElem = aPolyedreInfo->GetNbElem();
        
        if(aNbElem > 0){
-         PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
+         VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
          
-         aSubMesh->Init((MED::PElemInfo)aPolyedreInfo); 
+         aSubMesh->Init(MED::PElemInfo(aPolyedreInfo),theMed->GetVersion()); 
          aSubMesh->myNbCells = aNbElem;      
 
-         TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+         VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
          aCell2Connect.resize(aNbElem);
          
          for(TInt iElem = 0; iElem < aNbElem; iElem++){
            MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
-           TConnect& anArray = aCell2Connect[iElem];
+           VISU::TConnect& anArray = aCell2Connect[iElem];
            typedef std::set<TInt> TConnectSet;
            TConnectSet aConnectSet;
            TInt aNbFaces = aConnSliceArr.size();
@@ -1981,21 +2320,21 @@ VISU_MedConvertor
        TInt aNbElem = aCellInfo->GetNbElem();
        
        if(aNbElem > 0){
-         PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
+         VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
          
-         aSubMesh->Init((MED::PElemInfo)aCellInfo); 
+         aSubMesh->Init(MED::PElemInfo(aCellInfo), theMed->GetVersion()); 
          aSubMesh->myNbCells = aNbElem;      
          aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
 
-         TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+         VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
          aCell2Connect.resize(aNbElem);
        
          TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
-         TVector<TInt> aConnect(aMNbNodes);
+         VISU::TVector<TInt> aConnect(aMNbNodes);
        
          for(TInt iElem = 0; iElem < aNbElem; iElem++) {
            MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
-           TConnect& anArray = aCell2Connect[iElem];
+           VISU::TConnect& anArray = aCell2Connect[iElem];
            anArray.resize(aVNbNodes);
            
            if(anIsNodeNum){
@@ -2131,11 +2470,11 @@ VISU_MedConvertor
                    const VISU::PMEDMeshOnEntity theMeshOnEntity,
                    const VISU::PMEDFamily theFamily)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
 #ifndef _DEXCEPT_
   try{
 #endif
-    const TEntity& aVEntity = theMeshOnEntity->myEntity;
+    const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
     const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
 
     INITMSG(MYDEBUG,"LoadCellsOnFamily - aVEntity = "<<aVEntity<<"\n");
@@ -2146,36 +2485,55 @@ VISU_MedConvertor
     TInt anId = theFamily->myId;
 
     const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
-    TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
+    VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
+    MED::EMaillage aType = aMeshInfo->GetType();
 
     const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
     MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
     for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
       const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
-      MED::PElemInfo anElemInfo;
-      switch(aMGeom){
-      case MED::ePOLYGONE: {
-       anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
-       break;
-      }
-      case MED::ePOLYEDRE: {
-       anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
-       break;
-      }
-      default: {
-       anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
-       break;
-      }}
-      if(anElemInfo){
-       if(TInt aNbElem = anElemInfo->GetNbElem()){
-         TSubMeshID aSubMeshID;
-         for(TInt iElem = 0; iElem < aNbElem; iElem++) 
-           if(anElemInfo->GetFamNum(iElem) == anId)
-             aSubMeshID.push_back(iElem);
-         if(!aSubMeshID.empty()){
-           VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
-           INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
-           aGeom2SubMeshID.insert(TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
+      if(aType == MED::eNON_STRUCTURE){
+       MED::PElemInfo anElemInfo;
+       switch(aMGeom){
+       case MED::ePOLYGONE: {
+         anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
+         break;
+       }
+       case MED::ePOLYEDRE: {
+         anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
+         break;
+       }
+       default: {
+         anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
+         break;
+       }}
+       if(anElemInfo){
+         if(TInt aNbElem = anElemInfo->GetNbElem()){
+           VISU::TSubMeshID aSubMeshID;
+           for(TInt iElem = 0; iElem < aNbElem; iElem++) 
+             if(anElemInfo->GetFamNum(iElem) == anId)
+               aSubMeshID.push_back(iElem);
+           if(!aSubMeshID.empty()){
+             VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+             INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
+             aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
+           }
+         }
+       }
+      } else {
+       MED::PGrilleInfo anElemInfo = theMed->GetPGrilleInfo(aMeshInfo);
+       if(anElemInfo){
+         TInt aNbElem = anElemInfo->GetNbCells();
+         if(aNbElem>0 && (aMGeom == anElemInfo->GetGeom()) ){
+           VISU::TSubMeshID aSubMeshID;
+           for(TInt iElem = 0; iElem < aNbElem; iElem++) 
+             if(anElemInfo->GetFamNum(iElem) == anId)
+               aSubMeshID.push_back(iElem);
+           if(!aSubMeshID.empty()){
+             VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+             INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
+             aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
+           }
          }
        }
       }
@@ -2201,32 +2559,32 @@ VISU_MedConvertor
 void
 LoadProfile(const MED::PWrapper& theMed,
            VISU::PMEDMesh theMesh,
-           MED::TTimeStampVal& theTimeStampVal,
+           MED::PTimeStampValueBase theTimeStampValue,
            VISU::TMEDValForTime& theValForTime,
            VISU::TMEDMeshOnEntity& theMeshOnEntity)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
   INITMSG(MYDEBUG,"LoadProfile"<<endl);
 
-  PMEDProfile aProfile = theValForTime.myProfile;
+  VISU::PMEDProfile aProfile = theValForTime.myProfile;
   if(aProfile->myIsDone)
     return;
 
-  const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
-  const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
+  const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+  const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
   MED::TGeom2Profile::const_iterator anIter = aGeom2Profile.begin();
   for(; anIter != aGeom2Profile.end(); anIter++){
     MED::PProfileInfo aProfileInfo = anIter->second;
     MED::EGeometrieElement aMGeom = anIter->first;
     VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
 
-    TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom);
+    VISU::TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom);
     if(anIter2 != aGeom2SubProfile.end()){
-      PMEDSubProfile aSubProfile = anIter2->second;
+      VISU::PMEDSubProfile aSubProfile = anIter2->second;
 
       MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
       if(!anElemNum.empty()){
-       TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
+       VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
        TInt aSize = anElemNum.size();
        aSubMeshID.resize(aSize);
        for(TInt anId = 0; anId < aSize; anId++)
@@ -2242,13 +2600,13 @@ LoadProfile(const MED::PWrapper& theMed,
   {
     const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
     
-    TEntity aVEntity = theMeshOnEntity.myEntity;
+    VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
     MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
     
-    const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
-    TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
+    const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+    VISU::TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
     for(; anIter != aGeom2SubProfile.end(); anIter++){
-      const PMEDSubProfile& aSubProfile = anIter->second;
+      const VISU::PMEDSubProfile& aSubProfile = anIter->second;
       MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
       MED::PElemInfo anElemInfo;
       anElemInfo = theMed->GetPElemInfo(aMeshInfo,aMEntity,aMGeom);
@@ -2265,41 +2623,41 @@ LoadProfile(const MED::PWrapper& theMed,
 void
 LoadGaussMesh(const MED::PWrapper& theMed,
              VISU::PMEDMesh theMesh,
-             MED::TTimeStampVal& theTimeStampVal,
+             MED::PTimeStampValueBase theTimeStampValue,
              VISU::TMEDValForTime& theValForTime,
              VISU::TMEDMeshOnEntity& theMeshOnEntity)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
   INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
 
   // this part of code must be reimplemented in connection with GRILLE structures
   if(theMesh->myMeshInfo->GetType() == MED::eSTRUCTURE)
-    EXCEPTION(runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
+    EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
   
-  PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
+  VISU::PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
   if(!aGaussMesh || aGaussMesh->myIsDone)
     return;
 
   const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
   MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
 
-  TEntity aVEntity = theMeshOnEntity.myEntity;
+  VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
   MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
 
-  const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
-  const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
+  const VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+  const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
   const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
 
-  TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
+  VISU::TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
   for(; aSubMeshIter != aGeom2GaussSubMesh.end(); aSubMeshIter++){
-    PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
+    VISU::PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
     VISU::EGeometry aEGeom = aSubMeshIter->first;
     
     if(aGaussSubMesh->myIsDone)
       continue;
 
-    PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
-    const TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
+    VISU::PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
+    const VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
     MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
 
     MED::PPolygoneInfo aPolygoneInfo;
@@ -2330,12 +2688,13 @@ LoadGaussMesh(const MED::PWrapper& theMed,
     aGaussSubMesh->myElemNum = anElemInfo->myElemNum;
 
     std::string aName;
-    MED::TGaussCoord aGaussCoord;
     bool anIsGaussCoord3D = false;
+    MED::PGaussCoord aGaussCoordPtr(new MED::TGaussCoord());
+    MED::TGaussCoord& aGaussCoord = *aGaussCoordPtr;
 
     MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
     if(aGaussIter != aGeom2Gauss.end()){
-      PMEDGauss aGauss = aGaussSubMesh->myGauss;
+      VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
       MED::PGaussInfo aGaussInfo = aGauss->myGaussInfo;
       if(aGaussInfo){
        aName = aGaussInfo->GetName();
@@ -2404,24 +2763,17 @@ LoadGaussMesh(const MED::PWrapper& theMed,
     }
     
     if(anIsGaussCoord3D){
-      TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
-      TInt aNbGauss = aGaussCoord.GetNbGauss();
-      TInt aNbElem = aGaussCoord.GetNbElem();
-      TInt aDim = aGaussCoord.GetDim();
-      vtkIdType aNbCells = aNbElem*aNbGauss;
-      aCoords.Init(aNbCells,aDim);
-      for(TInt anElemId = 0, aNodeId = 0; anElemId < aNbElem; anElemId++){
-       MED::TCoordSliceArr aCoordSliceArr = aGaussCoord.GetCoordSliceArr(anElemId);
-       for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++, aNodeId++){
-         MED::TCoordSlice aCoordSlice = aCoordSliceArr[aGaussId];
-         TCoordSlice aSlice = aCoords.GetCoordSlice(aNodeId);
-         for(TInt aDimId = 0; aDimId < aDim; aDimId++)
-           aSlice[aDimId] = aCoordSlice[aDimId];
-       }
-      }
+      VISU::TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
+      VISU::TMEDGaussCoordHolder* aCoordHolder = new VISU::TMEDGaussCoordHolder();
+      aCoordHolder->Init(aGaussCoordPtr);
+      aCoords.Init(VISU::PCoordHolder(aCoordHolder));
       
-      aGaussSubMesh->myIsDone = true;;
+      aGaussSubMesh->myIsDone = true;
       
+      TInt aNbGauss = aGaussCoord.GetNbGauss();
+      TInt aNbElem = aGaussCoord.GetNbElem();
+      TInt aNbCells = aNbElem*aNbGauss;
+
       INITMSG(MYDEBUG,
              "- aEGeom = "<<aEGeom<<
              "; aName = '"<<aName<<"'"<<
@@ -2431,13 +2783,55 @@ LoadGaussMesh(const MED::PWrapper& theMed,
              "; aNbCells = "<<aNbCells<<
              endl);
     }else
-      EXCEPTION(runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
+      EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
   }
   
   aGaussMesh->myIsDone = true;
 }
 
 
+//---------------------------------------------------------------
+template<class TimeStampValueType>
+void
+FillValForTime(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
+              const VISU::TGeom2SubProfile& theGeom2SubProfile,
+              VISU::PMEDValForTime theValForTime,
+              VISU::PMEDField theField)
+{
+  theField->myDataSize = 0;
+  TInt aNbComp = theField->myNbComp;
+
+  VISU::TGeom2SubProfile::const_iterator anIter = theGeom2SubProfile.begin();
+  for(; anIter != theGeom2SubProfile.end(); anIter++){
+    VISU::EGeometry aEGeom = anIter->first;
+    VISU::PMEDSubProfile aSubProfile(anIter->second);
+
+    TInt aNbElem = aSubProfile->myNbCells;
+    theField->myDataSize += aNbElem * aNbComp;
+
+    if(aSubProfile->myStatus != VISU::eRemoveAll){
+      TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
+
+      INITMSG(MYDEBUG,
+             "- aEGeom = "<<aEGeom<<
+             "; aNbElem = "<<aNbElem<<
+             "; aNbGauss = "<<aNbGauss<<
+             endl);
+      
+      VISU::PMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
+      typedef typename TimeStampValueType::TElement TElement;
+      typedef VISU::TTMEDMeshValue<TElement> TVMeshValue;
+      TVMeshValue* aMeshValue = new TVMeshValue();
+
+      MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
+      typedef typename TimeStampValueType::PTMeshValue PTMeshValue;
+      PTMeshValue aMeshValuePtr = theTimeStampValue->GetMeshValuePtr(aMGeom);
+      aMeshValue->Init(aNbElem, aNbGauss, aNbComp, aMeshValuePtr);
+      aVMeshValue.reset(aMeshValue);
+    }
+  }
+}
+
 //---------------------------------------------------------------
 int 
 LoadValForTime(const MED::PWrapper& theMed,
@@ -2448,7 +2842,7 @@ LoadValForTime(const MED::PWrapper& theMed,
               bool theIsGauss,
               bool& theIsDone)
 {
-  TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
+  VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
   INITMSG(MYDEBUG,"LoadValForTime - theIsGauss = "<<theIsGauss<<endl);
 
   //Check on loading already done
@@ -2477,14 +2871,14 @@ LoadValForTime(const MED::PWrapper& theMed,
   MED::TKey2Gauss aKey2Gauss = GetKey2Gauss(theMed);
   MED::TMKey2Profile aMKey2Profile = GetMKey2Profile(theMed);
 
-  MED::PTimeStampVal aTimeStampVal = 
-    theMed->GetPTimeStampVal(aTimeStampInfo,
-                            aMKey2Profile,
-                            aKey2Gauss);
-
+  MED::PTimeStampValueBase aTimeStampValue = 
+    theMed->GetPTimeStampValue(aTimeStampInfo,
+                              aMKey2Profile,
+                              aKey2Gauss);
+  
   InitGaussProfile(theMed,
                   aMeshInfo,
-                  aTimeStampVal,
+                  aTimeStampValue,
                   theMeshOnEntity,
                   aMEntity,
                   aGeom2Size,
@@ -2492,73 +2886,37 @@ LoadValForTime(const MED::PWrapper& theMed,
 
   LoadProfile(theMed,
              theMesh,
-             aTimeStampVal,
+             aTimeStampValue,
              theValForTime,
              theMeshOnEntity);
   
   if(theIsGauss)
     LoadGaussMesh(theMed,
                  theMesh,
-                 aTimeStampVal,
+                 aTimeStampValue,
                  theValForTime,
                  theMeshOnEntity);
   
-  PMEDProfile aProfile = theValForTime->myProfile;
-  TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
-
-  TInt aNbComp = theField->myNbComp;
+  VISU::PMEDProfile aProfile = theValForTime->myProfile;
+  VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
 
   INITMSGA(MYDEBUG,0,
           "- aMeshName = '"<<aMeshName<<"'"<<
           "; aFieldName = '"<<aFieldInfo->GetName()<<"'"<<
           "; aMEntity = "<<aMEntity<<
-          "; aNbComp = "<<aNbComp<<
+          "; aNbComp = "<<theField->myNbComp<<
           endl);
 
-  theField->myDataSize = 0;
-
-  const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
-  TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
-  for(; anIter != aGeom2SubProfile.end(); anIter++){
-    VISU::EGeometry aEGeom = anIter->first;
-    PMEDSubProfile aSubProfile(anIter->second);
-
-    TInt aNbElem = aSubProfile->myNbCells;
-    theField->myDataSize += aNbElem*aNbComp;
-
-    if(aSubProfile->myStatus != eRemoveAll){
-      TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
-
-      INITMSG(MYDEBUG,
-             "- aEGeom = "<<aEGeom<<
-             "; aNbElem = "<<aNbElem<<
-             "; aNbGauss = "<<aNbGauss<<
-             endl);
-      
-      TMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
-      aVMeshValue.Init(aNbElem,aNbGauss,aNbComp);
-
-      MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
-      const MED::TMeshValue& aMMeshValue = aTimeStampValRef.GetMeshValue(aMGeom);
-      for(TInt iElem = 0; iElem < aNbElem; iElem++){
-       TValueSliceArr aVValueSliceArr = aVMeshValue.GetGaussValueSliceArr(iElem);
-       MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
-       ADDMSG(MYVALUEDEBUG,"{");
-       for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-         TValueSlice& aVValueSlice = aVValueSliceArr[iGauss];
-         const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
-         for(TInt iComp = 0; iComp < aNbComp; iComp++){
-           aVValueSlice[iComp] = aMValueSlice[iComp];
-           ADDMSG(MYVALUEDEBUG,aVValueSlice[iComp]<<" ");
-         }
-         ADDMSG(MYVALUEDEBUG,"| ");
-       }
-       ADDMSG(MYVALUEDEBUG,"} ");
-      }
-      ADDMSG(MYDEBUG,"\n");
-    }
-  }
-
+  if(aFieldInfo->GetType() == MED::eFLOAT64)
+    FillValForTime<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
+                                             aGeom2SubProfile,
+                                             theValForTime,
+                                             theField);
+  else
+    FillValForTime<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
+                                           aGeom2SubProfile,
+                                           theValForTime,
+                                           theField);
   theIsDone = true;
 
   return 1; 
@@ -2574,14 +2932,14 @@ VISU_MedConvertor
                       VISU::PMEDField theField, 
                       VISU::PMEDValForTime theValForTime)
 {
-  PIDMapperFilter anIDMapperFilter = theValForTime->myIDMapperFilter;
+  VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = theValForTime->myUnstructuredGridIDMapper;
   return LoadValForTime(theMed,
                        theMesh,
                        theMeshOnEntity,
                        theField,
                        theValForTime,
                        false,
-                       anIDMapperFilter->myIsVTKDone);
+                       anUnstructuredGridIDMapper->myIsVTKDone);
 }
 
 
@@ -2594,7 +2952,7 @@ VISU_MedConvertor
                           VISU::PMEDField theField, 
                           VISU::PMEDValForTime theValForTime)
 {
-  PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter;
+  VISU::PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter;
   return LoadValForTime(theMed,
                        theMesh,
                        theMeshOnEntity,