]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix on [Bug PAL7927] REGRESSION: It is an incorrect import of the MED file and incorr...
authorapo <apo@opencascade.com>
Mon, 31 Jan 2005 13:49:31 +0000 (13:49 +0000)
committerapo <apo@opencascade.com>
Mon, 31 Jan 2005 13:49:31 +0000 (13:49 +0000)
src/CONVERTOR/VISU_MedConvertor.cxx

index 16e0ac4b1e88612b2bd7d768d5cf69caa90f9855..a0434a30cd6c652ee092178ee109bccc9343be28 100644 (file)
@@ -149,312 +149,322 @@ VISU_MedConvertor::VISU_MedConvertor(const string& theFileName)  {
 }
 
 VISU_Convertor* VISU_MedConvertor::Build()  {
-  PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
-  TInt aNbMeshes = aMed->GetNbMeshes();
-  TMeshMap& aMeshMap = myMeshMap;
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+  MED::TInt aNbMeshes = aMed->GetNbMeshes();
 
   MSG(MYDEBUG,"VISU_MedConvertor::Build()");
   INITMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<"\n");
 
-  for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++)
+  for(MED::TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
     try{
-    PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
-
-    PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
-    
-    MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
-    
-    TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
+      MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+      
+      MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+      
+      MED::TElemGroup anElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
 
-    TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
+      // Find PNodeInfo
+      MED::TElemGroup::const_iterator anElemGroupIter = anElemGroup.find(MED::eNOEUD);
+      if(anElemGroupIter == anElemGroup.end())
+       continue;
 
-    TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aNodeInfo,aElemGroup,aFamilyGroup);
+      const MED::TElemMap& anElemMap = anElemGroupIter->second;
+      MED::TElemMap::const_iterator anElemMapIter = anElemMap.find(MED::ePOINT1);
+      if(anElemMapIter == anElemMap.end())
+       continue;
 
-    TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
+      MED::PNodeInfo aNodeInfo(anElemMapIter->second);
 
-    // creating TMesh structure and TMeshOnEntityMap
-    typedef map<TInt,TInt> TFamilyCounterMap;
-    TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
-    TFamilyCounterMap aFamilyNbPolygonesCounterMap, aFamilyPolygonesSizeCounterMap;
+      // creating TMesh structure and TMeshOnEntityMap
+      typedef std::map<TInt,TInt> TFamilyCounterMap;
+      TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
+      TFamilyCounterMap aFamilyNbPolygonesCounterMap, aFamilyPolygonesSizeCounterMap;
 
-    TInt aDim = aMeshInfo->GetDim();
-    const string& aMeshName = aMeshInfo->GetName();
+      MED::TInt aDim = aMeshInfo->GetDim();
+      std::string aMeshName = aMeshInfo->GetName();
     
-    PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
-    aMesh->myDim = aDim;
-    aMesh->myName = aMeshName;
-    aMesh->myNbPoints = aNodeInfo->GetNbElem();
-    aMesh->myMeshInfo = aMeshInfo;
-    aMesh->myEntityInfo = aEntityInfo;
-
-    INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
-           "'; myNbPoints = "<<aMesh->myNbPoints<<
-           "; aDim = "<<aDim<<"\n");
-    
-    BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
-
-    TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
-    MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
-    for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
-      const EEntiteMaillage& aMEntity = anEntityIter->first;
-      const MED::TGeom& aTGeom = anEntityIter->second;
-
-      TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
-      aMeshOnEntity->myEntity = aVEntity;
-      aMeshOnEntity->myMeshName = aMeshName;
-      aMeshOnEntity->myGeom = aTGeom;
-
-      INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
-
-      if(aMEntity == eNOEUD){
-       aMeshOnEntity->myNbCells = aMesh->myNbPoints;
-       aMeshOnEntity->myCellsSize = 2*aMesh->myNbPoints;
-       
-       for(TInt iElem = 0; iElem < aMesh->myNbPoints; iElem++){
-         TInt aFamId = aNodeInfo->GetFamNum(iElem);
-         if(aFamId != 0){
-           aFamilyNbCellsCounterMap[aFamId] += 1;
-           aFamilyCellsSizeCounterMap[aFamId] += 2;
+      VISU::PMEDMesh aMesh = myMeshMap[aMeshName](new VISU::TMEDMesh());
+      aMesh->myDim = aDim;
+      aMesh->myName = aMeshName;
+      aMesh->myNbPoints = aNodeInfo->GetNbElem();
+      aMesh->myMeshInfo = aMeshInfo;
+      aMesh->myEntityInfo = aEntityInfo;
+
+      INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
+             "'; myNbPoints = "<<aMesh->myNbPoints<<
+             "; aDim = "<<aDim<<"\n");
+      
+      BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
+
+      VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+      anElemGroupIter = anElemGroup.begin();
+      for(; anElemGroupIter != anElemGroup.end(); anElemGroupIter++){
+       const MED::EEntiteMaillage& aMEntity = anElemGroupIter->first;
+       const MED::TElemMap& anElemMap = anElemGroupIter->second;
+
+       VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+       VISU::PMEDMeshOnEntity aMeshOnEntity = 
+         aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
+       aMeshOnEntity->myEntity = aVEntity;
+       aMeshOnEntity->myMeshName = aMeshName;
+       aMeshOnEntity->myGeom = aEntityInfo[aMEntity];
+
+       INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
+
+       if(aMEntity == MED::eNOEUD){
+         aMeshOnEntity->myNbCells = aMesh->myNbPoints;
+         aMeshOnEntity->myCellsSize = 2*aMesh->myNbPoints;
+         
+         for(MED::TInt iElem = 0; iElem < aMesh->myNbPoints; iElem++){
+           MED::TInt aFamId = aNodeInfo->GetFamNum(iElem);
+           if(aFamId != 0){
+             aFamilyNbCellsCounterMap[aFamId] += 1;
+             aFamilyCellsSizeCounterMap[aFamId] += 2;
+           }
          }
-       }
 
-       INITMSG(MYDEBUG,"myNbCells = "<<aMeshOnEntity->myNbCells<<
-               "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");;
-
-      }else{
-       MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
-       aMeshOnEntity->myNbCells = 0;
-       aMeshOnEntity->myCellsSize = 0;
-       for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
-         const EGeometrieElement& aGeom = anTGeomIter->first;
-
-         switch(aGeom){
-         case ePOLYGONE:
-           {
-             PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom);
-             TInt aNbElem = aPolygoneInfo->GetNbElem();
-             TElemNum aConn  = aPolygoneInfo->GetConnectivite();
-             TElemNum aIndex = aPolygoneInfo->GetIndex();
-             TInt aNbIndex = aIndex.size();
-             TInt aNbConn  = aConn.size();
-
-             aMeshOnEntity->myNbCells += aNbElem;
+         INITMSG(MYDEBUG,"myNbCells = "<<aMeshOnEntity->myNbCells<<
+                 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");;
+
+       }else{
+         aMeshOnEntity->myNbCells = 0;
+         aMeshOnEntity->myCellsSize = 0;
+         anElemMapIter = anElemMap.begin();
+         for(; anElemMapIter != anElemMap.end(); anElemMapIter++){
+           const MED::EGeometrieElement& aGeom = anElemMapIter->first;
+           MED::PElemInfo anElemInfo = anElemMapIter->second;
+           
+           switch(aGeom){
+           case MED::ePOLYGONE: {
+             MED::PPolygoneInfo aPolygoneInfo(anElemInfo);
+             MED::TInt aNbElem = aPolygoneInfo->GetNbElem();
+             MED::TElemNum aConn  = aPolygoneInfo->GetConnectivite();
+             MED::TElemNum aIndex = aPolygoneInfo->GetIndex();
+             MED::TInt aNbConn  = aConn.size();
+           
+             aMeshOnEntity->myNbCells += aNbElem;
              
-             for (int ii = 0; ii<aNbElem ; ii++){
+             for (int ii = 0; ii<aNbElem ; ii++){
                int aNbConnii = aPolygoneInfo->GetNbConn(ii);
-               aMeshOnEntity->myCellsSize += aNbConnii;
-             }
+               aMeshOnEntity->myCellsSize += aNbConnii;
+             }
+
              INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
                      "; myNbPolygones = "<<aNbElem<<
                      "; nbConn= "<<aNbConn<<"\n");
              
-             for(TInt iElem = 0; iElem < aNbElem; iElem++){
-               TInt aFamId = aPolygoneInfo->GetFamNum(iElem);
-               if(aFamId != 0){
-                 aFamilyNbCellsCounterMap[aFamId] += 1;
-                 ADDMSG(MYDEBUG,"aFamId = "<<aFamId<<" ");
-                 aFamilyCellsSizeCounterMap[aFamId] += aPolygoneInfo->GetNbConn(iElem) + 1;
-               }
-             }
-             ADDMSG(MYDEBUG,endl);
+             for(MED::TInt iElem = 0; iElem < aNbElem; iElem++){
+               MED::TInt aFamId = aPolygoneInfo->GetFamNum(iElem);
+               if(aFamId != 0){
+                 aFamilyNbCellsCounterMap[aFamId] += 1;
+                 aFamilyCellsSizeCounterMap[aFamId] += aPolygoneInfo->GetNbConn(iElem) + 1;
+               }
+             }
              break;
            }
-         default:
-           {
+           default: {
              int aVNbNodes = VTKGeom2NbNodes(MEDGeomToVTK(aGeom));
-             PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
-             TInt aNbElem = aCellInfo->GetNbElem();
+             MED::PCellInfo aCellInfo(anElemInfo);
+             MED::TInt aNbElem = aCellInfo->GetNbElem();
              aMeshOnEntity->myNbCells += aNbElem;
              aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
              INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
                      "; myNbCells = "<<aMeshOnEntity->myNbCells<<
                      "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");
-             
-             for(TInt iElem = 0; iElem < aNbElem; iElem++){
-               TInt aFamId = aCellInfo->GetFamNum(iElem);
+           
+             for(MED::TInt iElem = 0; iElem < aNbElem; iElem++){
+               MED::TInt aFamId = aCellInfo->GetFamNum(iElem);
                if(aFamId != 0){
                  aFamilyNbCellsCounterMap[aFamId] += 1;
-                 ADDMSG(MYDEBUG,"aFamId = "<<aFamId<<" ");
                  aFamilyCellsSizeCounterMap[aFamId] += aVNbNodes + 1;
                }
              }
-             ADDMSG(MYDEBUG,endl);
-           }
-         } // end switch(...)
+           }}
+         }
        }
       }
-    }
-    
-    TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin();
-    BEGMSG(MYDEBUG,"TFamilyByEntity:\n");
-    for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){
-      const EEntiteMaillage& aMEntity = aFamilyByEntityIter->first;
-      const TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
-
-      TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
-      VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
-      
-      if(aFamilyGroup.empty())
-       continue;
 
-      INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
-      TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
-      for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
-       const PFamilyInfo& aFamilyInfo = *aFamilyGroupIter;
-       if (aFamilyInfo->GetId() == 0) 
-         continue;
+      BEGMSG(MYDEBUG,"TFamilyByEntity:\n");
+
+      MED::TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
+
+      MED::TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
+
+      MED::TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,anElemGroup,aFamilyGroup);
 
-       const std::string& aFamilyName = aFamilyInfo->GetName();
-       PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
+      MED::TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin();
+      for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){
+       const MED::EEntiteMaillage& aMEntity = aFamilyByEntityIter->first;
+       const MED::TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
        
-       aFamily->myId = aFamilyInfo->GetId();
-       aFamily->myName = aFamilyInfo->GetName();
-       aFamily->myEntity = aVEntity;
-       aFamily->myNbCells = aFamilyNbCellsCounterMap[aFamily->myId];
-       aFamily->myCellsSize = aFamilyCellsSizeCounterMap[aFamily->myId];
+       VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+       VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+       VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+      
+       if(aFamilyGroup.empty())
+         continue;
        
-       INITMSG(MYDEBUG,"aFamilyName = '"<<aFamily->myName<<
-               "'; myId = "<<aFamily->myId<<"; "<<
-               "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
-               "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
-               "; myEntity = "<<aFamily->myEntity<<
-               "; myNbCells = "<<aFamily->myNbCells<<
-               "; myCellsSize = "<<aFamily->myCellsSize<<"\n");
-
-       VISU::TBindGroups& aBindGroups = aFamily->myGroups;
-       const TInt aNbGroup = aFamilyInfo->GetNbGroup();
-       for(TInt i = 0; i < aNbGroup; i++){
-         const string& aGroupName = aFamilyInfo->GetGroupName(i);
-         aBindGroups.insert(aGroupName);
-         INITMSG(MYDEBUG,"aGroupName = '"<<aGroupName<<"'\n");
+       INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
+       MED::TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
+       for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
+         MED::PFamilyInfo aFamilyInfo = *aFamilyGroupIter;
+         if(aFamilyInfo->GetId() == 0) 
+           continue;
+         
+         std::string aFamilyName = aFamilyInfo->GetName();
+         VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
+         
+         aFamily->myId = aFamilyInfo->GetId();
+         aFamily->myName = aFamilyInfo->GetName();
+         aFamily->myEntity = aVEntity;
+         aFamily->myNbCells = aFamilyNbCellsCounterMap[aFamily->myId];
+         aFamily->myCellsSize = aFamilyCellsSizeCounterMap[aFamily->myId];
+         
+         INITMSG(MYDEBUG,"aFamilyName = '"<<aFamily->myName<<
+                 "'; myId = "<<aFamily->myId<<"; "<<
+                 "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
+                 "; myEntity = "<<aFamily->myEntity<<
+                 "; myNbCells = "<<aFamily->myNbCells<<
+                 "; myCellsSize = "<<aFamily->myCellsSize<<"\n");
+         
+         VISU::TBindGroups& aBindGroups = aFamily->myGroups;
+         MED::TInt aNbGroup = aFamilyInfo->GetNbGroup();
+         for(MED::TInt i = 0; i < aNbGroup; i++){
+           std::string aGroupName = aFamilyInfo->GetGroupName(i);
+           aBindGroups.insert(aGroupName);
+           INITMSG(MYDEBUG,"aGroupName = '"<<aGroupName<<"'\n");
+         }
        }
       }
-    }
-    
-    BEGMSG(MYDEBUG,"VISU::TGroup:\n");
-
-    VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
-    TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
-    for(;aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
-      const string& aGroupName = aGroupInfoIter->first;
-      const TFamilyGroup& aFamilyGroup = aGroupInfoIter->second;
-      PMEDGroup aGroup(new TMEDGroup());
-      aGroup->myName = aGroupName;
-      aGroup->myMeshName = aMesh->myName;
-
-      INITMSG(MYDEBUG,"aGroup->myName = '"<<aGroup->myName<<"'\n");
-
-      TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin();
-      for(; aFamilyIter != aFamilyGroup.end(); aFamilyIter++){
-       const PFamilyInfo& aFamilyInfo = *aFamilyIter;
-       const string& aFamilyName = aFamilyInfo->GetName();
-
-       TEntity aVEntity = TEntity(-1);
-       PFamily aFamily;
-
-       // Find aVisuEntity
-       const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
-       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();
-         for (; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
-           const string& aName = aFamilyMapIter->first;
-           aFamily = aFamilyMapIter->second;
-           if(aName == aFamilyName){
-             aVEntity = aFamily->myEntity;
-             goto exit_lable;
+      
+      BEGMSG(MYDEBUG,"VISU::TGroup:\n");
+
+      VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
+      MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
+      for(; aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
+       const std::string& aGroupName = aGroupInfoIter->first;
+       const MED::TFamilyGroup& aFamilyGroup = aGroupInfoIter->second;
+       VISU::PMEDGroup aGroup(new TMEDGroup());
+       aGroup->myName = aGroupName;
+       aGroup->myMeshName = aMesh->myName;
+       
+       INITMSG(MYDEBUG,"aGroup->myName = '"<<aGroup->myName<<"'\n");
+       
+       MED::TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin();
+       for(; aFamilyIter != aFamilyGroup.end(); aFamilyIter++){
+         MED::PFamilyInfo aFamilyInfo = *aFamilyIter;
+         std::string aFamilyName = aFamilyInfo->GetName();
+         
+         VISU::TEntity aVEntity = TEntity(-1);
+         VISU::PFamily aFamily;
+         
+         // Find aVisuEntity
+         const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+         VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
+         for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
+           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){
+               aVEntity = aFamily->myEntity;
+               goto exit_lable;
+             }
            }
          }
+       exit_lable:
+         if(aFamily && aVEntity >= 0){
+           aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity));
+           INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyName<<"'; '"<<aFamily->myName<<"'; aVEntity = "<<aVEntity<<"\n");
+           
+           aGroup->myNbCells += aFamily->myNbCells;
+           aGroup->myCellsSize += aFamily->myCellsSize;
+         }
        }
-      exit_lable:
-       if(aFamily && aVEntity >= 0){
-         aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity));
-         INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyName<<"'; '"<<aFamily->myName<<"'; aVEntity = "<<aVEntity<<"\n");
-         
-         aGroup->myNbCells += aFamily->myNbCells;
-         aGroup->myCellsSize += aFamily->myCellsSize;
+       if(!aGroup->myFamilyAndEntitySet.empty() && aGroup->myNbCells > 0){
+         BEGMSG(MYDEBUG,"myNbCells = "<<aGroup->myNbCells<<
+                "; myCellsSize = "<<aGroup->myCellsSize<<"\n\n");
+         aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
        }
       }
-      if(!aGroup->myFamilyAndEntitySet.empty() && aGroup->myNbCells > 0){
-       BEGMSG(MYDEBUG,"myNbCells = "<<aGroup->myNbCells<<
-              "; myCellsSize = "<<aGroup->myCellsSize<<"\n\n");
-       aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
-      }
-    }
-    
-    TInt aNbFields = aMed->GetNbFields(); 
-    BEGMSG(MYDEBUG,"VISU::TField: NbFields="<<aNbFields<<"\n");
-    for(TInt iField = 1; iField <= aNbFields; iField++){
-      PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
-      TInt aNbComp = aFieldInfo->GetNbComp();
-      const string& aFieldName = aFieldInfo->GetName();
-
-      MED::TGeom aTGeom;
-      EEntiteMaillage aMEntity;
-      TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,aMEntity,aTGeom);
-      TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      VISU::PMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
-      TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
-      PMEDField aField = aFieldMap[aFieldName](new TMEDField());
-      aField->myId = iField;
-      aField->myNbComp = aNbComp;
-      aField->myEntity = aVEntity;
-      aField->myName = aFieldName;
-      aField->myMeshName = aMeshName;
-      aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
-      aField->myCompNames.resize(aNbComp);
-      aField->myUnitNames.resize(aNbComp);
-
-      INITMSG(MYDEBUG,"myName = '"<<aField->myName<<
-             "'; myId = "<<aField->myId<<
-             "; myEntity = "<<aField->myEntity<<
-             "; myDataSize = "<<aField->myDataSize<<
-             "; myNbComp = "<<aField->myNbComp<<"\n");
-
-      for(TInt iComp = 0; iComp < aNbComp; iComp++){
-       aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
-       aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
-      }
-
-      for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
-       PTimeStampInfo aTimeStamp = aMed->GetPTimeStampInfo(aFieldInfo,
-                                                           aMEntity,
-                                                           aTGeom,
-                                                           iTimeStamp);
-       TFloat aDt = aTimeStamp->GetDt();
-       const string& anUnitDt = aTimeStamp->GetUnitDt();
-       PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp);
-       TValField& aValField = aField->myValField;
-       PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
-       aValForTime->myId = iTimeStamp;
-       aValForTime->myFieldName = aField->myName;
-       aValForTime->myEntity = aField->myEntity;
-       aValForTime->myMeshName = aField->myMeshName;
-       aValForTime->myNbComp = aField->myNbComp;
-       aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
-       INITMSG(MYDEBUG,"aDt = "<<aDt<<", "<<anUnitDt<<"\n");
+      
+      MED::TInt aNbFields = aMed->GetNbFields(); 
+      BEGMSG(MYDEBUG,"VISU::TField aNbFields = "<<aNbFields<<"\n");
+      for(MED::TInt iField = 1; iField <= aNbFields; iField++){
+       MED::PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
+       MED::TInt aNbComp = aFieldInfo->GetNbComp();
+       std::string aFieldName = aFieldInfo->GetName();
+       
+       MED::TGeom aTGeom;
+       MED::EEntiteMaillage aMEntity;
+       MED::TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,aMEntity,aTGeom);
+       VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+       VISU::PMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+       VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+       VISU::PMEDField aField = aFieldMap[aFieldName](new TMEDField());
+       aField->myId = iField;
+       aField->myNbComp = aNbComp;
+       aField->myEntity = aVEntity;
+       aField->myName = aFieldName;
+       aField->myMeshName = aMeshName;
+       aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
+       aField->myCompNames.resize(aNbComp);
+       aField->myUnitNames.resize(aNbComp);
+
+       INITMSG(MYDEBUG,"myName = '"<<aField->myName<<
+               "'; myId = "<<aField->myId<<
+               "; myEntity = "<<aField->myEntity<<
+               "; myDataSize = "<<aField->myDataSize<<
+               "; myNbComp = "<<aField->myNbComp<<"\n");
+       
+       for(MED::TInt iComp = 0; iComp < aNbComp; iComp++){
+         aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
+         aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
+       }
+       
+       for(MED::TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
+         MED::TErr anErr;
+         MED::PTimeStampInfo aTimeStamp = aMed->GetPTimeStampInfo(aFieldInfo,
+                                                                  aMEntity,
+                                                                  aTGeom,
+                                                                  iTimeStamp,
+                                                                  &anErr);
+         if(anErr < 0)
+           continue;
+         
+         MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp,&anErr);
+         
+         MED::TFloat aDt = aTimeStamp->GetDt();
+         std::string anUnitDt = aTimeStamp->GetUnitDt();
+         VISU::TValField& aValField = aField->myValField;
+         VISU::PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
+         aValForTime->myId = iTimeStamp;
+         aValForTime->myFieldName = aField->myName;
+         aValForTime->myEntity = aField->myEntity;
+         aValForTime->myMeshName = aField->myMeshName;
+         aValForTime->myNbComp = aField->myNbComp;
+         aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
+         INITMSG(MYDEBUG,"aDt = "<<aDt<<", "<<anUnitDt<<"\n");
+       }
       }
+    }catch (std::exception& exc){
+      MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+    }catch(...){
+      EXCEPTION(runtime_error,"Unknown exception !!!");
     }
-  } catch (std::runtime_error& exc){
-    MSG(MYDEBUG,"Follow exception wqs occured in:\n"<<exc.what());
-  } catch(...){
-    EXCEPTION(runtime_error,"Unknown exception !!!");
   }
-
   return this; 
 }
 
 int VISU_MedConvertor::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
                                        const string& theFamilyName)
 {
-  PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
-  const string& aMeshName = theMeshOnEntity->myMeshName;
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+  const std::string& aMeshName = theMeshOnEntity->myMeshName;
   const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
-  PMeshImpl aMesh = myMeshMap[aMeshName];
+  VISU::PMeshImpl aMesh = myMeshMap[aMeshName];
   int isPointsUpdated;
   if(anEntity == VISU::NODE_ENTITY) 
     isPointsUpdated = LoadPoints(aMed,aMesh,theFamilyName);
@@ -468,11 +478,11 @@ int VISU_MedConvertor::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity,
 int VISU_MedConvertor::LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
                                       const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
 {
-  PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
   int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
   VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
   for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
-    const string& aFamilyName = aFamilyAndEntitySetIter->first;
+    const std::string& aFamilyName = aFamilyAndEntitySetIter->first;
     const VISU::TEntity& anEntity = aFamilyAndEntitySetIter->second;
     const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
     if(anEntity == VISU::NODE_ENTITY){
@@ -492,7 +502,7 @@ int VISU_MedConvertor::LoadFieldOnMesh(VISU::PMeshImpl theMesh,
                                       VISU::PFieldImpl theField, 
                                       VISU::PValForTimeImpl theValForTime)
 {
-  PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
   int isPointsUpdated = LoadPoints(aMed,theMesh);
   int isCellsOnEntityUpdated = LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
   int isFieldUpdated = LoadField(aMed,theMesh,theMeshOnEntity,theField,theValForTime);
@@ -511,7 +521,7 @@ VISU_MedConvertor::LoadPoints(const MED::PWrapper& theMed,
     VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
     aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
     aMeshOnEntity->myMeshName = theMesh->myName;
-    PFamilyImpl aFamily = GetFamily(aMeshOnEntity,theFamilyName);
+    VISU::PFamilyImpl aFamily = GetFamily(aMeshOnEntity,theFamilyName);
     //Check on loading already done
     bool isPointsLoaded = !theMesh->myPointsCoord.empty();
     if(isPointsLoaded) 
@@ -521,10 +531,10 @@ VISU_MedConvertor::LoadPoints(const MED::PWrapper& theMed,
        return 0;
 
     INITMSG(MYDEBUG,"LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'\n");
-
+    
     //Main part of code
-    PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
-    TInt aNbElem = aNodeInfo->GetNbElem();
+    MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
+    MED::TInt aNbElem = aNodeInfo->GetNbElem();
 
     if(!isPointsLoaded){
       VISU::TMeshImpl::TPointsDim&  aPointsDim = theMesh->myPointsDim;
@@ -534,14 +544,14 @@ VISU_MedConvertor::LoadPoints(const MED::PWrapper& theMed,
       
       VISU::TMeshImpl::TPointsCoord& aPointsCoord = theMesh->myPointsCoord;
       aPointsCoord.resize(aNbElem*theMesh->myDim);
-      for (int iElem = 0; iElem < aNbElem; iElem++) 
+      for(int iElem = 0; iElem < aNbElem; iElem++) 
        for(int iDim = 0, iElem2Dim = iElem*theMesh->myDim; iDim < theMesh->myDim; iDim++, iElem2Dim++)
          aPointsCoord[iElem2Dim] = aNodeInfo->GetNodeCoord(iElem,iDim);
       
       VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aMeshOnEntity->myCellsConn[VTK_VERTEX];
       aConnForCellType.resize(aNbElem);
       for (int iElem = 0; iElem < aNbElem; iElem++)
-       aConnForCellType[iElem] = VISU::TMeshOnEntityImpl::TConnect(1,iElem);
+       aConnForCellType[iElem] = TMeshOnEntityImpl::TConnect(1,iElem);
     }
     if(aFamily && aNbElem > 0){
       VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[VTK_VERTEX];
@@ -550,7 +560,8 @@ VISU_MedConvertor::LoadPoints(const MED::PWrapper& theMed,
          aSubMeshOnCellType.insert(iElem);
     }
     return 1;
-  }catch(std::runtime_error& exc){
+  }catch(std::exception& exc){
+    MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
     theMesh->myPointsCoord.clear();
     throw;
   }catch(...){
@@ -569,7 +580,7 @@ VISU_MedConvertor::LoadCellsOnEntity(const MED::PWrapper& theMed,
 {
   try{
     //Check on existing family
-    PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
+    VISU::PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
     //Check on loading already done
     bool isCellsLoaded = !theMeshOnEntity->myCellsConn.empty();
     if(isCellsLoaded)
@@ -582,19 +593,19 @@ VISU_MedConvertor::LoadCellsOnEntity(const MED::PWrapper& theMed,
     BEGMSG(MYDEBUG,"LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<bool(aFamily)<<endl);
 
     const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
-    const EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
+    const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
 
-    const PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
-    PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
-    TInt aNbPoints = aNodeInfo->GetNbElem();
+    MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+    MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
+    MED::TInt aNbPoints = aNodeInfo->GetNbElem();
 
     std::map<TInt,TInt> aNodeIdMap;
 #ifdef _EDF_NODE_IDS_
-    EBooleen anIsNodeNum = eFAUX;
+    MED::EBooleen anIsNodeNum = MED::eFAUX;
 #else
-    EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
+    MED::EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
     if(anIsNodeNum){
-      for(TInt i = 0; i < aNbPoints; i++){
+      for(MED::TInt i = 0; i < aNbPoints; i++){
        aNodeIdMap[aNodeInfo->GetElemNum(i)-1] = i;
       }
     }
@@ -602,116 +613,112 @@ VISU_MedConvertor::LoadCellsOnEntity(const MED::PWrapper& theMed,
 
     const MED::TGeom& aTGeom = theMeshOnEntity->myGeom;
     MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
-    TMeshOnEntityImpl::TCellsConn& aCellsConn = theMeshOnEntity->myCellsConn;
+    VISU::TMeshOnEntityImpl::TCellsConn& aCellsConn = theMeshOnEntity->myCellsConn;
 
     for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
-      const EGeometrieElement& aGeom = anTGeomIter->first;
+      const MED::EGeometrieElement& aGeom = anTGeomIter->first;
       int aVTKGeomType = MEDGeomToVTK(aGeom);
-      ADDMSG(MYDEBUG,"LoadCellsOnEntity aGeom="<<aGeom<<"\n");
       switch(aGeom){
-      case ePOLYGONE:
-       {
-         PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom);
-         TInt aNbElem = aPolygoneInfo->GetNbElem();
+      case MED::ePOLYGONE: {
+       MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom);
+       MED::TInt aNbElem = aPolygoneInfo->GetNbElem();
+       
+       if(!isCellsLoaded){
+         VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolygoneType = aCellsConn[aVTKGeomType];
+         aConnForPolygoneType.resize(aNbElem);
+         
+         int aMNbNodes = aPolygoneInfo->GetConnDim();
          
-         if(!isCellsLoaded){
-           VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolygoneType = aCellsConn[aVTKGeomType];
-           aConnForPolygoneType.resize(aNbElem);
+         vector<MED::TInt> aConnect(aMNbNodes);
+         vector<MED::TInt> aIndex = aPolygoneInfo->GetIndex();
+         
+         for(int iElem = 0; iElem < aNbElem; iElem++){
+           VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForPolygoneType[iElem];
+           int aNbConn = aPolygoneInfo->GetNbConn(iElem);
            
-           int aMNbNodes = aPolygoneInfo->GetConnDim();
+           anArray.resize(aNbConn);
            
-           vector<TInt> aConnect(aMNbNodes);
-           vector<TInt> aIndex = aPolygoneInfo->GetIndex();
-
-           for (int iElem = 0; iElem < aNbElem; iElem++) {
-             VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForPolygoneType[iElem];
-             int aNbConn = aPolygoneInfo->GetNbConn(iElem);
-
-             anArray.resize(aNbConn);
-             
-             aConnect = aPolygoneInfo->GetConnectivite();
-             
-             for (int i=0;i<aNbConn;i++){
-               anArray[i] = aConnect[aIndex[iElem]-1+i]-1;
-             }
+           aConnect = aPolygoneInfo->GetConnectivite();
+           
+           for(int i = 0 ; i < aNbConn; i++){
+             anArray[i] = aConnect[aIndex[iElem]-1+i]-1;
            }
          }
-         if(aFamily){
-           VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
-           for(int iElem = 0; iElem < aNbElem; iElem++) 
-             if(aPolygoneInfo->GetFamNum(iElem) == aFamily->myId)
-               aSubMeshOnCellType.insert(iElem);
-         }
-         break;
        }
-      default:
-       {
-         int aVNbNodes = VTKGeom2NbNodes(aVTKGeomType);
+       if(aFamily){
+         VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
+         for(int iElem = 0; iElem < aNbElem; iElem++) 
+           if(aPolygoneInfo->GetFamNum(iElem) == aFamily->myId)
+             aSubMeshOnCellType.insert(iElem);
+       }
+       break;
+      }
+      default: {
+       int aVNbNodes = VTKGeom2NbNodes(aVTKGeomType);
+       
+       MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
+       MED::TInt aNbElem = aCellInfo->GetNbElem();
+       
+       if(!isCellsLoaded){
+         VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConn[aVTKGeomType];
+         aConnForCellType.resize(aNbElem);
          
-         PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
-         TInt aNbElem = aCellInfo->GetNbElem();
+         int aMNbNodes = MEDGeom2NbNodes(aGeom);
+         vector<MED::TInt> aConnect(aMNbNodes);
          
-         if(!isCellsLoaded){
-           VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConn[aVTKGeomType];
-           aConnForCellType.resize(aNbElem);
+         for(int iElem = 0; iElem < aNbElem; iElem++) {
+           TMeshOnEntityImpl::TConnect& anArray = aConnForCellType[iElem];
+           anArray.resize(aVNbNodes);
            
-           int aMNbNodes = MEDGeom2NbNodes(aGeom);
-           vector<TInt> aConnect(aMNbNodes);
-         
-           for (int iElem = 0; iElem < aNbElem; iElem++) {
-             VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForCellType[iElem];
-             anArray.resize(aVNbNodes);
-             
-             if(anIsNodeNum){
-               for(int i = 0; i < aMNbNodes; i++){
-                 aConnect[i] = aNodeIdMap[aCellInfo->GetConn(iElem,i)-1];
-               }
-             }else{
-               for(int i = 0; i < aMNbNodes; i++){
-                 aConnect[i] = aCellInfo->GetConn(iElem,i)-1;
-               }
+           if(anIsNodeNum){
+             for(int i = 0; i < aMNbNodes; i++){
+               aConnect[i] = aNodeIdMap[aCellInfo->GetConn(iElem,i)-1];
              }
-             
-             switch(aGeom){
-             case eTETRA4:
-             case eTETRA10:
-               anArray[0] = aConnect[0];
-               anArray[1] = aConnect[1];
-               anArray[2] = aConnect[3];  
-               anArray[3] = aConnect[2];  
-               break;
-             case ePYRA5:
-             case ePYRA13:
-               anArray[0] = aConnect[0];
-               anArray[1] = aConnect[3];  
-               anArray[2] = aConnect[2];
-               anArray[3] = aConnect[1];  
-               anArray[4] = aConnect[4];
-               break;
-             default:
-               for(int iNode = 0; iNode < aVNbNodes; iNode++) 
-                 anArray[iNode] = aConnect[iNode];
+           }else{
+             for(int i = 0; i < aMNbNodes; i++){
+               aConnect[i] = aCellInfo->GetConn(iElem,i)-1;
              }
+           }
+           
+           switch(aGeom){
+           case MED::eTETRA4:
+           case MED::eTETRA10:
+             anArray[0] = aConnect[0];
+             anArray[1] = aConnect[1];
+             anArray[2] = aConnect[3];  
+             anArray[3] = aConnect[2];  
+             break;
+           case MED::ePYRA5:
+           case MED::ePYRA13:
+             anArray[0] = aConnect[0];
+             anArray[1] = aConnect[3];  
+             anArray[2] = aConnect[2];
+             anArray[3] = aConnect[1];  
+             anArray[4] = aConnect[4];
+             break;
+           default:
              for(int iNode = 0; iNode < aVNbNodes; iNode++) 
-               if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
-                 EXCEPTION(runtime_error,"ImportCells >> aNbPoints("<<aNbPoints<<") "<<
-                           "<= anArray["<<iElem<<"]"<<
-                           "["<<iNode<<"]"<<
-                           "("<<anArray[iNode]<<") < 0");
+               anArray[iNode] = aConnect[iNode];
            }
-         }
-         //Filling aFamily SubMesh
-         if(aFamily){
-           VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
-           for(int iElem = 0; iElem < aNbElem; iElem++) 
-             if(aCellInfo->GetFamNum(iElem) == aFamily->myId)
-               aSubMeshOnCellType.insert(iElem);
+           for(int iNode = 0; iNode < aVNbNodes; iNode++) 
+             if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
+               EXCEPTION(runtime_error,"ImportCells >> aNbPoints("<<aNbPoints<<") "<<
+                         "<= anArray["<<iElem<<"]"<<
+                         "["<<iNode<<"]"<<
+                         "("<<anArray[iNode]<<") < 0");
          }
        }
-      }
+       //Filling aFamily SubMesh
+       if(aFamily){
+         VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
+         for(int iElem = 0; iElem < aNbElem; iElem++) 
+           if(aCellInfo->GetFamNum(iElem) == aFamily->myId)
+             aSubMeshOnCellType.insert(iElem);
+       }
+      }}
     }
     return 1;
-  }catch(std::runtime_error& exc){
+  }catch(std::exception& exc){
     theMeshOnEntity->myCellsConn.clear();
     throw;
   }catch(...){
@@ -733,35 +740,29 @@ VISU_MedConvertor::LoadField(const MED::PWrapper& theMed,
   if(!theValForTime->myValForCells.empty()) return 0;
 
   //Main part of code
-  const std::string& aMeshName = theMeshOnEntity->myMeshName;
-  const PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
-  PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,theField->myId);
+  MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
+  MED::TInt anId = theField->myId;
+  MED::PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,anId);
 
   MED::TGeom aTGeom;
-  EEntiteMaillage aMEntity;
-  theMed->GetNbTimeStamps(aFieldInfo,theMesh->myEntityInfo,aMEntity,aTGeom);
+  MED::EEntiteMaillage aMEntity;
+  const MED::TEntityInfo& anEntityInfo = theMesh->myEntityInfo;
+  theMed->GetNbTimeStamps(aFieldInfo,anEntityInfo,aMEntity,aTGeom);
 
-  PTimeStampInfo aTimeStampInfo = theMed->GetPTimeStampInfo(aFieldInfo,
-                                                           aMEntity,
-                                                           aTGeom,
-                                                           theValForTime->myId);
-  TInt aNbGauss = aTimeStampInfo->GetNbGauss();
-  TInt aNbComp = theField->myNbComp;
+  anId = theValForTime->myId;
+  MED::PTimeStampInfo aTimeStampInfo = 
+    theMed->GetPTimeStampInfo(aFieldInfo,aMEntity,aTGeom,anId);
 
-  PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo);
+  MED::PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo);
 
-  INITMSG(MYDEBUG,"LoadField - aMeshName = '"<<aMeshName<<
-         "'; aFieldName = '"<<aFieldInfo->GetName()<<
-         "'; aMEntity = "<<aMEntity<<
-         "; anId = "<<theValForTime->myId<<endl);
-  BEGMSG(MYDEBUG,"LoadField - aNbComp = "<<aNbComp<<
-        "; aNbGauss = "<<aNbGauss<<endl);
+  MED::TInt aNbGauss = aTimeStampInfo->GetNbGauss();
+  MED::TInt aNbComp = theField->myNbComp;
 
   const MED::TGeom& anEntityTGeom = theMeshOnEntity->myGeom;
   MED::TGeom::const_iterator aTGeomIter = anEntityTGeom.begin();
   for(; aTGeomIter != anEntityTGeom.end(); aTGeomIter++){
-    const EGeometrieElement& aGeom = aTGeomIter->first;
-    const TInt& aNbElem = aTGeomIter->second;
+    const MED::EGeometrieElement& aGeom = aTGeomIter->first;
+    const MED::TInt& aNbElem = aTGeomIter->second;
 
     INITMSG(MYDEBUG,"LoadField - aGeom = "<<aGeom<<"; aNbElem = '"<<aNbElem<<endl);
 
@@ -772,9 +773,9 @@ VISU_MedConvertor::LoadField(const MED::PWrapper& theMed,
       int aVTKGeomType = MEDGeomToVTK(aGeom);
       VISU::TValForTimeImpl::TValForCellsWithType& anArray = theValForTime->myValForCells[aVTKGeomType];
       anArray.resize(aNbComp*aNbElem);
-      for(TInt iElem = 0, anId = 0; iElem < aNbElem; iElem++){
-       for(TInt iComp = 0; iComp < aNbComp; iComp++, anId++){
-         for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+      for(MED::TInt iElem = 0, anId = 0; iElem < aNbElem; iElem++){
+       for(MED::TInt iComp = 0; iComp < aNbComp; iComp++, anId++){
+         for(MED::TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
            anArray[anId] += aTimeStampVal->GetVal(aGeom,iElem,iComp,iGauss);
          }
          anArray[anId] /= aNbGauss;